Update the permission scope (#19603)

1. Update the permission scope
2. Sort the resources and actions by unicode

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2023-11-22 14:37:31 +08:00 committed by GitHub
parent 9875965837
commit d967ac0fb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 17 deletions

View File

@ -102,9 +102,7 @@ var (
{Resource: ResourceReplication, Action: ActionRead}, {Resource: ResourceReplication, Action: ActionRead},
{Resource: ResourceReplication, Action: ActionCreate}, {Resource: ResourceReplication, Action: ActionCreate},
{Resource: ResourceReplication, Action: ActionDelete},
{Resource: ResourceReplication, Action: ActionList}, {Resource: ResourceReplication, Action: ActionList},
{Resource: ResourceReplication, Action: ActionUpdate},
{Resource: ResourceReplicationAdapter, Action: ActionList}, {Resource: ResourceReplicationAdapter, Action: ActionList},
@ -145,7 +143,6 @@ var (
{Resource: ResourceLabel, Action: ActionRead}, {Resource: ResourceLabel, Action: ActionRead},
{Resource: ResourceLabel, Action: ActionCreate}, {Resource: ResourceLabel, Action: ActionCreate},
{Resource: ResourceLabel, Action: ActionDelete}, {Resource: ResourceLabel, Action: ActionDelete},
{Resource: ResourceLabel, Action: ActionList},
{Resource: ResourceLabel, Action: ActionUpdate}, {Resource: ResourceLabel, Action: ActionUpdate},
{Resource: ResourceSecurityHub, Action: ActionRead}, {Resource: ResourceSecurityHub, Action: ActionRead},
@ -154,11 +151,7 @@ var (
{Resource: ResourceCatalog, Action: ActionRead}, {Resource: ResourceCatalog, Action: ActionRead},
}, },
"Project": { "Project": {
{Resource: ResourceLabel, Action: ActionRead}, {Resource: ResourceLog, Action: ActionList},
{Resource: ResourceLabel, Action: ActionCreate},
{Resource: ResourceLabel, Action: ActionDelete},
{Resource: ResourceLabel, Action: ActionList},
{Resource: ResourceLabel, Action: ActionUpdate},
{Resource: ResourceProject, Action: ActionRead}, {Resource: ResourceProject, Action: ActionRead},
{Resource: ResourceProject, Action: ActionDelete}, {Resource: ResourceProject, Action: ActionDelete},
@ -192,7 +185,7 @@ var (
{Resource: ResourceAccessory, Action: ActionList}, {Resource: ResourceAccessory, Action: ActionList},
{Resource: ResourceArtifactAddition, Action: ActionCreate}, {Resource: ResourceArtifactAddition, Action: ActionRead},
{Resource: ResourceArtifactLabel, Action: ActionCreate}, {Resource: ResourceArtifactLabel, Action: ActionCreate},
{Resource: ResourceArtifactLabel, Action: ActionDelete}, {Resource: ResourceArtifactLabel, Action: ActionDelete},
@ -211,19 +204,23 @@ var (
{Resource: ResourceImmutableTag, Action: ActionList}, {Resource: ResourceImmutableTag, Action: ActionList},
{Resource: ResourceImmutableTag, Action: ActionUpdate}, {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: ActionRead},
{Resource: ResourceTagRetention, Action: ActionCreate}, {Resource: ResourceTagRetention, Action: ActionCreate},
{Resource: ResourceTagRetention, Action: ActionDelete}, {Resource: ResourceTagRetention, Action: ActionDelete},
{Resource: ResourceTagRetention, Action: ActionList}, {Resource: ResourceTagRetention, Action: ActionList},
{Resource: ResourceTagRetention, Action: ActionUpdate}, {Resource: ResourceTagRetention, Action: ActionUpdate},
{Resource: ResourceLog, Action: ActionList}, {Resource: ResourceLabel, Action: ActionRead},
{Resource: ResourceLabel, Action: ActionCreate},
{Resource: ResourceNotificationPolicy, Action: ActionRead}, {Resource: ResourceLabel, Action: ActionDelete},
{Resource: ResourceNotificationPolicy, Action: ActionCreate}, {Resource: ResourceLabel, Action: ActionList},
{Resource: ResourceNotificationPolicy, Action: ActionDelete}, {Resource: ResourceLabel, Action: ActionUpdate},
{Resource: ResourceNotificationPolicy, Action: ActionList},
{Resource: ResourceNotificationPolicy, Action: ActionUpdate},
}, },
} }
) )

View File

@ -88,6 +88,8 @@ export class RobotPermissionsPanelComponent
this.candidateActions.push(item?.action); this.candidateActions.push(item?.action);
} }
}); });
this.candidateActions.sort();
this.candidateResources.sort();
} }
isCandidate(resource: string, action: string): boolean { isCandidate(resource: string, action: string): boolean {

View File

@ -162,7 +162,7 @@ class TestRobotAccount(unittest.TestCase):
expected_error_message = expected_error_message expected_error_message = expected_error_message
) )
def Atest_02_SystemlevelRobotAccount(self): def test_02_SystemlevelRobotAccount(self):
""" """
Test case: Test case:
Robot Account Robot Account