diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-03-14 05:28:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-14 05:28:30 +0100 |
commit | 51e154f5e87968d6bb115e053689767ab33e80cd (patch) | |
tree | d86ba475bfc61ba7a774bf36e24704dc82f68991 /app/policies | |
parent | 6e3936aa6f4296ac202b54c0b178b4fa825d7885 (diff) |
Admission-based registrations mode (#10250)
Fix #6856 Fix #6951
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/user_policy.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index 57af5c61c..d832bff75 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -21,6 +21,14 @@ class UserPolicy < ApplicationPolicy staff? end + def approve? + staff? && !record.approved? + end + + def reject? + staff? && !record.approved? + end + def disable? staff? && !record.admin? end @@ -36,7 +44,7 @@ class UserPolicy < ApplicationPolicy private def promoteable? - !record.staff? || !record.admin? + record.approved? && (!record.staff? || !record.admin?) end def demoteable? |