Skip to content

Commit fc16b85

Browse files
Exchange the POST and PUT http methods (#84)
* exchange the behaviour of PUT and POST * assert post and put in respect of their privileges * bump the version number
1 parent ea4da99 commit fc16b85

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject com.flexiana/framework "0.2.1"
1+
(defproject com.flexiana/framework "0.2.2"
22
:description "Framework"
33
:url "https://github.com/Flexiana/framework"
44
:license {:name "FIXME" :url "FIXME"}

src/framework/acl/core.clj

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
(def action-mapping
88
{:get :read
9-
:post :update
10-
:put :create
9+
:post :create
10+
:put :update
1111
:delete :delete})
1212

1313
(defn- ->resource
@@ -35,8 +35,8 @@
3535
|req: | action: |
3636
|------- |---------|
3737
|:get | :read |
38-
|:post | :update |
39-
|:put | :create |
38+
|:post | :create |
39+
|:put | :update |
4040
|:delete | :delete |"
4141
([{{user :user} :session-data
4242
roles :acl/roles

test/framework/acl/core_test.clj

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
(get-error (is-allowed (state-with-user-request guest "/items/" :post)))))
116116
(is (= :own
117117
(get-ok (is-allowed (state-with-user-request member "/addresses/" :post)))))
118+
(is (= :own
119+
(get-ok (is-allowed (state-with-user-request member "/users/" :put)))))
120+
(is (= {:status 401, :body "Authorization error"}
121+
(get-error (is-allowed (state-with-user-request member "/users/" :post)))))
118122
(is (= :all
119123
(get-ok (is-allowed (state-with-user-request admin "/items/" :get)))))
120124
(is (= :all

0 commit comments

Comments
 (0)