diff --git a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/resources/OpPermissionFacadeResourceImpl.kt b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/resources/OpPermissionFacadeResourceImpl.kt index dd62a8db77f..73d23c81687 100644 --- a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/resources/OpPermissionFacadeResourceImpl.kt +++ b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/resources/OpPermissionFacadeResourceImpl.kt @@ -17,7 +17,7 @@ class OpPermissionFacadeResourceImpl( customGroupCreateReq: CustomGroupCreateReq ): Result { return Result( - resourceGroupService.createCustomGroupAndPermissions( + data = resourceGroupService.createCustomGroupAndPermissions( projectId = projectId, customGroupCreateReq = customGroupCreateReq ) diff --git a/support-files/sql/5001_init_dml/5001_ci_auth-init_dml_mysql.sql b/support-files/sql/5001_init_dml/5001_ci_auth-init_dml_mysql.sql index bfd98999c03..1f1aa3b206e 100644 --- a/support-files/sql/5001_init_dml/5001_ci_auth-init_dml_mysql.sql +++ b/support-files/sql/5001_init_dml/5001_ci_auth-init_dml_mysql.sql @@ -158,7 +158,7 @@ REPLACE INTO T_AUTH_RESOURCE_GROUP_CONFIG(`ID`,`RESOURCE_TYPE`, `GROUP_CODE`, `G REPLACE INTO T_AUTH_RESOURCE_GROUP_CONFIG(`ID`,`RESOURCE_TYPE`, `GROUP_CODE`, `GROUP_NAME`, `CREATE_MODE`, `DESCRIPTION`, `AUTHORIZATION_SCOPES`, `ACTIONS`) values(4, "project", "pm", "PM", 0, 'PM can view the pipeline list, download or share artifacts in the custom-path artifactory', '[{\"system\":\"#system#\",\"actions\":[{\"id\":\"project_visit\"},{\"id\":\"project_list\"},{\"id\":\"codecc_rule_set_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"project\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"pipeline_list\"},{\"id\":\"pipeline_download\"},{\"id\":\"pipeline_share\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"pipeline\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"pipeline_template_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"pipeline_template\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"codecc_task_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"codecc_task\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"repertory_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"repertory\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"credential_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"credential\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"cert_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"cert\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"environment_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"environment\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"env_node_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"env_node\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"experience_task_view\"},{\"id\":\"experience_task_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"experience_task\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"experience_group_view\"},{\"id\":\"experience_group_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"experience_group\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"rule_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"rule\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"quality_group_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"quality_group\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]}]', '[\"project_visit\",\"project_list\",\"codecc_rule_set_list\"]'); REPLACE INTO T_AUTH_RESOURCE_GROUP_CONFIG(`ID`,`RESOURCE_TYPE`, `GROUP_CODE`, `GROUP_NAME`, `CREATE_MODE`, `DESCRIPTION`, `AUTHORIZATION_SCOPES`, `ACTIONS`) values(5, "project", "tester", "QA", 0, 'QA can create pipelines, repos, credentials, certificates, agent pools, agents, codecc tasks, codecc rule sets, download and share artifacts in the custom-path artifactory', '[{\"system\":\"#system#\",\"actions\":[{\"id\":\"project_visit\"},{\"id\":\"project_list\"},{\"id\":\"pipeline_create\"},{\"id\":\"codecc_task_create\"},{\"id\":\"codecc_rule_set_create\"},{\"id\":\"codecc_rule_set_list\"},{\"id\":\"repertory_create\"},{\"id\":\"credential_create\"},{\"id\":\"cert_create\"},{\"id\":\"environment_create\"},{\"id\":\"env_node_create\"},{\"id\":\"experience_task_create\"},{\"id\":\"experience_group_create\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"project\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"pipeline_list\"},{\"id\":\"pipeline_download\"},{\"id\":\"pipeline_share\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"pipeline\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"pipeline_template_view\"},{\"id\":\"pipeline_template_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"pipeline_template\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"codecc_task_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"codecc_task\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"repertory_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"repertory\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"credential_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"credential\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"cert_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"cert\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"environment_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"environment\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"env_node_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"env_node\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"experience_task_view\"},{\"id\":\"experience_task_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"experience_task\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"experience_group_view\"},{\"id\":\"experience_group_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"experience_group\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"rule_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"rule\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"quality_group_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"quality_group\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]}]', '[\"project_visit\",\"project_list\",\"pipeline_create\",\"codecc_task_create\",\"codecc_rule_set_create\",\"codecc_rule_set_list\",\"repertory_create\",\"credential_create\",\"cert_create\",\"environment_create\",\"env_node_create\",\"experience_task_create\",\"experience_group_create\"]'); REPLACE INTO T_AUTH_RESOURCE_GROUP_CONFIG(`ID`,`RESOURCE_TYPE`, `GROUP_CODE`, `GROUP_NAME`, `CREATE_MODE`, `DESCRIPTION`, `AUTHORIZATION_SCOPES`, `ACTIONS`) values(6, "project", "qc", "QC", 0, 'QC can manage quality red line rules', '[{\"system\":\"#system#\",\"actions\":[{\"id\":\"project_visit\"},{\"id\":\"project_list\"},{\"id\":\"codecc_rule_set_list\"},{\"id\":\"rule_create\"},{\"id\":\"quality_group_create\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"project\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"pipeline_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"pipeline\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"pipeline_template_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"pipeline_template\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"codecc_task_view-defect\"},{\"id\":\"codecc_task_view-report\"},{\"id\":\"codecc_task_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"codecc_task\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"repertory_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"repertory\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"rule_edit\"},{\"id\":\"rule_delete\"},{\"id\":\"rule_enable\"},{\"id\":\"rule_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"rule\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"quality_group_edit\"},{\"id\":\"quality_group_delete\"},{\"id\":\"quality_group_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"quality_group\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]}]', '[\"project_visit\",\"project_list\",\"codecc_rule_set_list\",\"rule_create\",\"quality_group_create\"]'); -REPLACE INTO T_AUTH_RESOURCE_GROUP_CONFIG(`ID`,`RESOURCE_TYPE`, `GROUP_CODE`, `GROUP_NAME`, `CREATE_MODE`, `DESCRIPTION`, `AUTHORIZATION_SCOPES`, `ACTIONS`) values(7, "project", "visitor", "Guest", 0, 'Guest can view the pipeline list', '[{\"system\":\"#system#\",\"actions\":[{\"id\":\"project_visit\"},{\"id\":\"project_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"project\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"pipeline_list\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"pipeline\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]}]', '[\"project_visit\",\"project_list\"]'); +REPLACE INTO T_AUTH_RESOURCE_GROUP_CONFIG(`ID`,`RESOURCE_TYPE`, `GROUP_CODE`, `GROUP_NAME`, `CREATE_MODE`, `DESCRIPTION`, `AUTHORIZATION_SCOPES`, `ACTIONS`) values(7, "project", "visitor", "Guest", 0, 'Guest can view the pipeline list', '[{"system":"#system#","actions":[{"id":"project_visit"},{"id":"project_list"}],"resources":[{"system":"#system#","type":"project","paths":[[{"system":"#system#","type":"project","id":"#projectId#","name":"#projectName#"}]]}]}]', '[\"project_visit\",\"project_list\"]'); REPLACE INTO T_AUTH_RESOURCE_GROUP_CONFIG(`ID`,`RESOURCE_TYPE`, `GROUP_CODE`, `GROUP_NAME`, `CREATE_MODE`, `DESCRIPTION`, `AUTHORIZATION_SCOPES`, `ACTIONS`) values(8, "pipeline", "manager", "Owner", 0, 'Pipeline owner can manage the permissions of the current pipeline', '[{\"system\":\"#system#\",\"actions\":[{\"id\":\"project_visit\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"project\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"pipeline_view\"},{\"id\":\"pipeline_edit\"},{\"id\":\"pipeline_delete\"},{\"id\":\"pipeline_execute\"},{\"id\":\"pipeline_list\"},{\"id\":\"pipeline_download\"},{\"id\":\"pipeline_share\"},{\"id\":\"pipeline_manage\"},{\"id\":\"pipeline_archive\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"pipeline\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"},{\"system\":\"#system#\",\"type\":\"pipeline\",\"id\":\"#resourceCode#\",\"name\":\"#resourceName#\"}]]}]}]', '[\"pipeline_view\",\"pipeline_edit\",\"pipeline_delete\",\"pipeline_execute\",\"pipeline_list\",\"pipeline_download\",\"pipeline_share\",\"pipeline_manage\",\"pipeline_archive\"]'); REPLACE INTO T_AUTH_RESOURCE_GROUP_CONFIG(`ID`,`RESOURCE_TYPE`, `GROUP_CODE`, `GROUP_NAME`, `CREATE_MODE`, `DESCRIPTION`, `AUTHORIZATION_SCOPES`, `ACTIONS`) values(9, "pipeline", "editor", "Editor", 0, 'Pipeline editor has all permissions for the current pipeline except for permission management', '[{\"system\":\"#system#\",\"actions\":[{\"id\":\"project_visit\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"project\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"}]]}]},{\"system\":\"#system#\",\"actions\":[{\"id\":\"pipeline_view\"},{\"id\":\"pipeline_edit\"},{\"id\":\"pipeline_execute\"},{\"id\":\"pipeline_list\"},{\"id\":\"pipeline_download\"},{\"id\":\"pipeline_share\"}],\"resources\":[{\"system\":\"#system#\",\"type\":\"pipeline\",\"paths\":[[{\"system\":\"#system#\",\"type\":\"project\",\"id\":\"#projectId#\",\"name\":\"#projectName#\"},{\"system\":\"#system#\",\"type\":\"pipeline\",\"id\":\"#resourceCode#\",\"name\":\"#resourceName#\"}]]}]}]', '[\"pipeline_view\",\"pipeline_edit\",\"pipeline_execute\",\"pipeline_list\",\"pipeline_download\",\"pipeline_share\"]');