Set permissions correctly for structure spec

This commit is contained in:
Joe Nelson
2014-12-06 17:42:42 -08:00
parent 7d58097449
commit 605372f829
2 changed files with 19 additions and 6 deletions
+14 -6
View File
@@ -11,12 +11,9 @@ import Network.HTTP.Types
spec :: Spec
spec = before resetDb $ around withApp $ do
describe "GET /" $
it "lists views in schema" $ do
_ <- post "/dbapi/users" [json| { "id":"jdoe", "pass": "1234", "role": "dbapi_test_author" } |]
let auth = authHeader "jdoe" "1234"
request methodGet "/" [auth] ""
describe "GET /" $ do
it "lists views in schema" $
request methodGet "/" [] ""
`shouldRespondWith` [json| [
{"schema":"1","name":"auto_incrementing_pk","insertable":true}
, {"schema":"1","name":"compound_pk","insertable":true}
@@ -28,6 +25,17 @@ spec = before resetDb $ around withApp $ do
] |]
{matchStatus = 200}
it "lists only views user has permission to see" $ do
_ <- post "/dbapi/users" [json| { "id":"jdoe", "pass": "1234", "role": "dbapi_test_author" } |]
let auth = authHeader "jdoe" "1234"
request methodGet "/" [auth] ""
`shouldRespondWith` [json| [
{"schema":"1","name":"authors_only","insertable":true}
] |]
{matchStatus = 200}
describe "Table info" $ do
it "is available with OPTIONS verb" $
request methodOptions "/menagerie" [] "" `shouldRespondWith`
+5
View File
@@ -741,6 +741,11 @@ GRANT ALL ON TABLE compound_pk TO dbapi_test;
GRANT ALL ON TABLE compound_pk TO dbapi_anonymous;
REVOKE ALL ON TABLE has_fk FROM PUBLIC;
REVOKE ALL ON TABLE has_fk FROM dbapi_test;
GRANT ALL ON TABLE has_fk TO dbapi_test;
GRANT ALL ON TABLE has_fk TO dbapi_anonymous;
--
-- TOC entry 2328 (class 0 OID 0)
-- Dependencies: 197