Set permissions correctly for structure spec
This commit is contained in:
@@ -11,12 +11,9 @@ import Network.HTTP.Types
|
|||||||
|
|
||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec = before resetDb $ around withApp $ do
|
spec = before resetDb $ around withApp $ do
|
||||||
describe "GET /" $
|
describe "GET /" $ do
|
||||||
it "lists views in schema" $ do
|
it "lists views in schema" $
|
||||||
_ <- post "/dbapi/users" [json| { "id":"jdoe", "pass": "1234", "role": "dbapi_test_author" } |]
|
request methodGet "/" [] ""
|
||||||
let auth = authHeader "jdoe" "1234"
|
|
||||||
|
|
||||||
request methodGet "/" [auth] ""
|
|
||||||
`shouldRespondWith` [json| [
|
`shouldRespondWith` [json| [
|
||||||
{"schema":"1","name":"auto_incrementing_pk","insertable":true}
|
{"schema":"1","name":"auto_incrementing_pk","insertable":true}
|
||||||
, {"schema":"1","name":"compound_pk","insertable":true}
|
, {"schema":"1","name":"compound_pk","insertable":true}
|
||||||
@@ -28,6 +25,17 @@ spec = before resetDb $ around withApp $ do
|
|||||||
] |]
|
] |]
|
||||||
{matchStatus = 200}
|
{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
|
describe "Table info" $ do
|
||||||
it "is available with OPTIONS verb" $
|
it "is available with OPTIONS verb" $
|
||||||
request methodOptions "/menagerie" [] "" `shouldRespondWith`
|
request methodOptions "/menagerie" [] "" `shouldRespondWith`
|
||||||
|
|||||||
Vendored
+5
@@ -741,6 +741,11 @@ GRANT ALL ON TABLE compound_pk TO dbapi_test;
|
|||||||
GRANT ALL ON TABLE compound_pk TO dbapi_anonymous;
|
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)
|
-- TOC entry 2328 (class 0 OID 0)
|
||||||
-- Dependencies: 197
|
-- Dependencies: 197
|
||||||
|
|||||||
Reference in New Issue
Block a user