Skip to content

Commit

Permalink
Update the permission scope (#19603)
Browse files Browse the repository at this point in the history
1. Update the permission scope
2. Sort the resources and actions by unicode

Signed-off-by: AllForNothing <[email protected]>
  • Loading branch information
AllForNothing authored Nov 22, 2023
1 parent 9875965 commit d967ac0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
29 changes: 13 additions & 16 deletions src/common/rbac/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ var (

{Resource: ResourceReplication, Action: ActionRead},
{Resource: ResourceReplication, Action: ActionCreate},
{Resource: ResourceReplication, Action: ActionDelete},
{Resource: ResourceReplication, Action: ActionList},
{Resource: ResourceReplication, Action: ActionUpdate},

{Resource: ResourceReplicationAdapter, Action: ActionList},

Expand Down Expand Up @@ -145,7 +143,6 @@ var (
{Resource: ResourceLabel, Action: ActionRead},
{Resource: ResourceLabel, Action: ActionCreate},
{Resource: ResourceLabel, Action: ActionDelete},
{Resource: ResourceLabel, Action: ActionList},
{Resource: ResourceLabel, Action: ActionUpdate},

{Resource: ResourceSecurityHub, Action: ActionRead},
Expand All @@ -154,11 +151,7 @@ var (
{Resource: ResourceCatalog, Action: ActionRead},
},
"Project": {
{Resource: ResourceLabel, Action: ActionRead},
{Resource: ResourceLabel, Action: ActionCreate},
{Resource: ResourceLabel, Action: ActionDelete},
{Resource: ResourceLabel, Action: ActionList},
{Resource: ResourceLabel, Action: ActionUpdate},
{Resource: ResourceLog, Action: ActionList},

{Resource: ResourceProject, Action: ActionRead},
{Resource: ResourceProject, Action: ActionDelete},
Expand Down Expand Up @@ -192,7 +185,7 @@ var (

{Resource: ResourceAccessory, Action: ActionList},

{Resource: ResourceArtifactAddition, Action: ActionCreate},
{Resource: ResourceArtifactAddition, Action: ActionRead},

{Resource: ResourceArtifactLabel, Action: ActionCreate},
{Resource: ResourceArtifactLabel, Action: ActionDelete},
Expand All @@ -211,19 +204,23 @@ var (
{Resource: ResourceImmutableTag, Action: ActionList},
{Resource: ResourceImmutableTag, Action: ActionUpdate},

{Resource: ResourceNotificationPolicy, Action: ActionRead},
{Resource: ResourceNotificationPolicy, Action: ActionCreate},
{Resource: ResourceNotificationPolicy, Action: ActionDelete},
{Resource: ResourceNotificationPolicy, Action: ActionList},
{Resource: ResourceNotificationPolicy, Action: ActionUpdate},

{Resource: ResourceTagRetention, Action: ActionRead},
{Resource: ResourceTagRetention, Action: ActionCreate},
{Resource: ResourceTagRetention, Action: ActionDelete},
{Resource: ResourceTagRetention, Action: ActionList},
{Resource: ResourceTagRetention, Action: ActionUpdate},

{Resource: ResourceLog, Action: ActionList},

{Resource: ResourceNotificationPolicy, Action: ActionRead},
{Resource: ResourceNotificationPolicy, Action: ActionCreate},
{Resource: ResourceNotificationPolicy, Action: ActionDelete},
{Resource: ResourceNotificationPolicy, Action: ActionList},
{Resource: ResourceNotificationPolicy, Action: ActionUpdate},
{Resource: ResourceLabel, Action: ActionRead},
{Resource: ResourceLabel, Action: ActionCreate},
{Resource: ResourceLabel, Action: ActionDelete},
{Resource: ResourceLabel, Action: ActionList},
{Resource: ResourceLabel, Action: ActionUpdate},
},
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export class RobotPermissionsPanelComponent
this.candidateActions.push(item?.action);
}
});
this.candidateActions.sort();
this.candidateResources.sort();
}

isCandidate(resource: string, action: string): boolean {
Expand Down
2 changes: 1 addition & 1 deletion tests/apitests/python/test_robot_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def verify_repository_unpushable(self, project_access_list, system_ra_client, ex
expected_error_message = expected_error_message
)

def Atest_02_SystemlevelRobotAccount(self):
def test_02_SystemlevelRobotAccount(self):
"""
Test case:
Robot Account
Expand Down

0 comments on commit d967ac0

Please sign in to comment.