Skip to content

Commit

Permalink
Merge pull request #57 from clanhr/allow-absences-manager-access-to-r…
Browse files Browse the repository at this point in the history
…eports

Allow 'absencesManager' to access reports
  • Loading branch information
paulosilva86 committed Apr 26, 2019
2 parents 48399e1 + 2e0450b commit 07d98bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject clanhr/auth "1.28.0"
(defproject clanhr/auth "1.29.0"
:description "ClanHR's Auth Library"
:url "https://github.com/clanhr/auth"
:license {:name "The MIT License"
Expand Down
3 changes: 2 additions & 1 deletion src/clanhr/auth/authorization_rules.clj
Expand Up @@ -19,12 +19,13 @@

(def ^:const approver "approver")
(def ^:const expenses-manager "expensesManager")
(def ^:const absences-manager "absencesManager")

(def ^:const rules
"Maps specific actions or zones to allowed roles"
{:directory-access (:full-access profile)
:notifications-access (:full-access profile)
:reports-access (:board-member-manager profile)
:reports-access (conj (:board-member-manager profile) absences-manager)
:can-manage-groups (:board-member-manager profile)
:can-manage-absences (:board-member profile)
:can-manage-roles (:board-member profile)
Expand Down
4 changes: 3 additions & 1 deletion test/clanhr/auth/authorization_rules_test.clj
Expand Up @@ -27,7 +27,9 @@
(is (result/succeeded?
(authorization-rules/run :change-expense-state ["expensesManager"])))
(is (result/succeeded?
(authorization-rules/run :can-auto-approve-expenses ["expensesManager"]))))
(authorization-rules/run :can-auto-approve-expenses ["expensesManager"])))
(is (result/succeeded?
(authorization-rules/run :reports-access ["absencesManager"]))))

(testing "do not have access"
(is (result/forbidden?
Expand Down

0 comments on commit 07d98bf

Please sign in to comment.