diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-02-26 15:06:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-26 15:06:03 +0100 |
commit | 6a4be4e96677eb3e1303ddcab8f8b4bea7298453 (patch) | |
tree | 52627bf6dd64b0a33e280442b2de60b4e802a544 /app/models/user_role.rb | |
parent | 45087c1092143e95dfcc85b6c9abc5c6c0a0a5c2 (diff) | |
parent | b91756fd4d475edff890e460c44b3a7245ad51e2 (diff) |
Merge pull request #2119 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/user_role.rb')
-rw-r--r-- | app/models/user_role.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/user_role.rb b/app/models/user_role.rb index 74dfdc220..a1b91dc0f 100644 --- a/app/models/user_role.rb +++ b/app/models/user_role.rb @@ -163,6 +163,7 @@ class UserRole < ApplicationRecord def in_permissions?(privilege) raise ArgumentError, "Unknown privilege: #{privilege}" unless FLAGS.key?(privilege) + computed_permissions & FLAGS[privilege] == FLAGS[privilege] end @@ -172,6 +173,7 @@ class UserRole < ApplicationRecord def validate_own_role_edition return unless defined?(@current_account) && @current_account.user_role.id == id + errors.add(:permissions_as_keys, :own_role) if permissions_changed? errors.add(:position, :own_role) if position_changed? end |