diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /app/policies/organizations | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'app/policies/organizations')
-rw-r--r-- | app/policies/organizations/organization_policy.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/policies/organizations/organization_policy.rb b/app/policies/organizations/organization_policy.rb index cac8d07811d..1c0d996c7d4 100644 --- a/app/policies/organizations/organization_policy.rb +++ b/app/policies/organizations/organization_policy.rb @@ -2,8 +2,22 @@ module Organizations class OrganizationPolicy < BasePolicy + condition(:organization_user) { @subject.user?(@user) } + + desc 'Organization is public' + condition(:public_organization, scope: :subject, score: 0) { true } + + rule { public_organization }.policy do + enable :read_organization + end + rule { admin }.policy do enable :admin_organization + enable :read_organization + end + + rule { organization_user }.policy do + enable :read_organization end end end |