diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 18:19:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 18:19:03 +0300 |
commit | 14bd84b61276ef29b97d23642d698de769bacfd2 (patch) | |
tree | f9eba90140c1bd874211dea17750a0d422c04080 /app/models/ability.rb | |
parent | 891c388697b2db0d8ee0c8358a9bdbf6dc56d581 (diff) |
Add latest changes from gitlab-org/gitlab@15-10-stable-eev15.10.0-rc42
Diffstat (limited to 'app/models/ability.rb')
-rw-r--r-- | app/models/ability.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb index eb645bcd653..4da4d113a7f 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -77,6 +77,8 @@ class Ability policy = policy_for(user, subject) + before_check(policy, ability.to_sym, user, subject, opts) + case opts[:scope] when :user DeclarativePolicy.user_scope { policy.allowed?(ability) } @@ -92,6 +94,11 @@ class Ability forget_runner_result(policy.runner(ability)) if policy && ability_forgetting? end + # Hook call right before ability check. + def before_check(policy, ability, user, subject, opts) + # See Support::AbilityCheck and Support::PermissionsCheck. + end + def policy_for(user, subject = :global) DeclarativePolicy.policy_for(user, subject, cache: ::Gitlab::SafeRequestStore.storage) end |