Skip to content

Commit

Permalink
Merge pull request #60 from clanhr/allow-self-approver-on-expenses
Browse files Browse the repository at this point in the history
Allow self-approver to approve pending expenses
  • Loading branch information
paulosilva86 committed Dec 5, 2019
2 parents a9c73e4 + 3c2b2f6 commit c4edf73
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject clanhr/auth "1.31.0"
(defproject clanhr/auth "1.32.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 @@ -18,6 +18,7 @@
:administrator-member ["admin" "hrmanager"]})

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

Expand All @@ -35,7 +36,7 @@
:can-mark-account-as-paid (:developer-member profile)
:change-absence-state (conj (:board-member profile) approver absences-manager)
:change-expense-state (conj (:board-member profile) approver expenses-manager)
:can-auto-approve-expenses (conj (:board-member profile) approver expenses-manager)
:can-auto-approve-expenses (conj (:board-member profile) approver self-approver expenses-manager)
:settings-access (conj (:board-member profile) absences-manager expenses-manager)
:can-see-full-user-info (:board-member profile)
:delete-user (:board-member profile)
Expand Down
2 changes: 2 additions & 0 deletions test/clanhr/auth/authorization_rules_test.clj
Expand Up @@ -28,6 +28,8 @@
(authorization-rules/run :change-expense-state ["expensesManager"])))
(is (result/succeeded?
(authorization-rules/run :can-auto-approve-expenses ["expensesManager"])))
(is (result/succeeded?
(authorization-rules/run :can-auto-approve-expenses ["self-approver"])))
(is (result/succeeded?
(authorization-rules/run :reports-access ["absencesManager"])))
(is (result/succeeded?
Expand Down

0 comments on commit c4edf73

Please sign in to comment.