Commit 8498210c authored by Rajendra Kadam's avatar Rajendra Kadam

Update custom emoji policy with delegate rules

parent 5a95770f
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
class CustomEmojiPolicy < BasePolicy class CustomEmojiPolicy < BasePolicy
delegate { @subject.group } delegate { @subject.group }
condition(:admin_custom_emoji) do condition(:author) { @subject.creator == @user }
@subject.group.member?(@user, Gitlab::Access::MAINTAINER) || @subject.creator == @user
rule { can?(:maintainer_access) }.policy do
enable :delete_custom_emoji
end end
rule { admin_custom_emoji }.policy do rule { author & can?(:developer_access) }.policy do
enable :delete_custom_emoji enable :delete_custom_emoji
end end
end end
...@@ -132,6 +132,7 @@ class GroupPolicy < BasePolicy ...@@ -132,6 +132,7 @@ class GroupPolicy < BasePolicy
enable :create_custom_emoji enable :create_custom_emoji
enable :create_package enable :create_package
enable :create_package_settings enable :create_package_settings
enable :developer_access
end end
rule { reporter }.policy do rule { reporter }.policy do
...@@ -161,6 +162,7 @@ class GroupPolicy < BasePolicy ...@@ -161,6 +162,7 @@ class GroupPolicy < BasePolicy
enable :read_deploy_token enable :read_deploy_token
enable :create_jira_connect_subscription enable :create_jira_connect_subscription
enable :update_runners_registration_token enable :update_runners_registration_token
enable :maintainer_access
end end
rule { owner }.policy do rule { owner }.policy do
......
...@@ -1935,14 +1935,14 @@ Input type: `DestroyCustomEmojiInput` ...@@ -1935,14 +1935,14 @@ Input type: `DestroyCustomEmojiInput`
| Name | Type | Description | | Name | Type | Description |
| ---- | ---- | ----------- | | ---- | ---- | ----------- |
| <a id="mutationdestroycustomemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | | <a id="mutationdestroycustomemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationdestroycustomemojiid"></a>`id` | [`CustomEmojiID!`](#customemojiid) | The global ID of the custom emoji to destroy. | | <a id="mutationdestroycustomemojiid"></a>`id` | [`CustomEmojiID!`](#customemojiid) | Global ID of the custom emoji to destroy. |
#### Fields #### Fields
| Name | Type | Description | | Name | Type | Description |
| ---- | ---- | ----------- | | ---- | ---- | ----------- |
| <a id="mutationdestroycustomemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | | <a id="mutationdestroycustomemojiclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationdestroycustomemojicustomemoji"></a>`customEmoji` | [`CustomEmoji`](#customemoji) | The deleted custom emoji. | | <a id="mutationdestroycustomemojicustomemoji"></a>`customEmoji` | [`CustomEmoji`](#customemoji) | Deleted custom emoji. |
| <a id="mutationdestroycustomemojierrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. | | <a id="mutationdestroycustomemojierrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. |
### `Mutation.destroyEpicBoard` ### `Mutation.destroyEpicBoard`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment