Fix #399 insert records in tables with no SELECT privileges
This commit is contained in:
@@ -93,6 +93,15 @@ spec struct pool = beforeAll_ resetDb $ around (withApp cfgDefault struct pool)
|
||||
simpleHeaders p `shouldSatisfy` matchHeader hLocation "/no_pk\\?a=eq.bar&b=eq.baz"
|
||||
simpleStatus p `shouldBe` created201
|
||||
|
||||
it "can insert in tables with no select privileges" $ do
|
||||
p <- request methodPost "/insertonly"
|
||||
[("Prefer", "return=minimal")]
|
||||
[json| { "v":"some value" } |]
|
||||
liftIO $ do
|
||||
simpleBody p `shouldBe` ""
|
||||
simpleStatus p `shouldBe` created201
|
||||
|
||||
|
||||
it "can post nulls" $ do
|
||||
p <- request methodPost "/no_pk"
|
||||
[("Prefer", "return=representation")]
|
||||
|
||||
@@ -28,6 +28,7 @@ spec struct pool = around (withApp cfgDefault struct pool) $ do
|
||||
, {"schema":"test","name":"has_count_column","insertable":false}
|
||||
, {"schema":"test","name":"has_fk","insertable":true}
|
||||
, {"schema":"test","name":"insertable_view_with_join","insertable":true}
|
||||
, {"schema":"test","name":"insertonly","insertable":true}
|
||||
, {"schema":"test","name":"items","insertable":true}
|
||||
, {"schema":"test","name":"json","insertable":true}
|
||||
, {"schema":"test","name":"materialized_view","insertable":false}
|
||||
|
||||
Vendored
+2
@@ -34,6 +34,8 @@ GRANT ALL ON TABLE
|
||||
, users_tasks
|
||||
TO postgrest_test_anonymous;
|
||||
|
||||
GRANT INSERT ON TABLE insertonly TO postgrest_test_anonymous;
|
||||
|
||||
GRANT USAGE ON SEQUENCE
|
||||
auto_incrementing_pk_id_seq
|
||||
, items_id_seq
|
||||
|
||||
Vendored
+9
@@ -500,6 +500,15 @@ CREATE TABLE nullable_integer (
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: insertonly; Type: TABLE; Schema: test; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE insertonly (
|
||||
v text NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: projects; Type: TABLE; Schema: test; Owner: -
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user