Skip to content

Commit

Permalink
feat:用户个人视角 权限管理优化 #11138
Browse files Browse the repository at this point in the history
  • Loading branch information
fcfang123 committed Dec 19, 2024
1 parent 14a83b4 commit 34887b5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
package com.tencent.devops.auth.api.user

import com.tencent.devops.auth.pojo.enum.OperateChannel
import com.tencent.devops.auth.pojo.vo.AuthProjectVO
import com.tencent.devops.auth.pojo.vo.ResourceTypeInfoVo
import com.tencent.devops.common.api.auth.AUTH_HEADER_DEVOPS_USER_ID
import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID
import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID_DEFAULT_VALUE
import com.tencent.devops.common.api.model.SQLPage
Expand Down Expand Up @@ -142,4 +144,13 @@ interface UserAuthAuthorizationResource {
@Parameter(description = "资源授权交接条件实体", required = true)
condition: ResetAllResourceAuthorizationReq
): Result<List<ResourceTypeInfoVo>>

@GET
@Path("/listUserProjectsWithAuthorization")
@Operation(summary = "获取用户授权相关的项目")
fun listUserProjectsWithAuthorization(
@HeaderParam(AUTH_HEADER_DEVOPS_USER_ID)
@Parameter(description = "用户ID", required = true)
userId: String
): Result<List<AuthProjectVO>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,4 @@ interface UserAuthResourceResource {
@PathParam("resourceCode")
resourceCode: String
): Result<AuthResourceInfo>

@GET
@Path("/listUserProjectsWithAuthorization")
@Operation(summary = "获取用户授权相关的项目")
fun listUserProjectsWithAuthorization(
@HeaderParam(AUTH_HEADER_DEVOPS_USER_ID)
@Parameter(description = "用户ID", required = true)
userId: String
): Result<List<AuthProjectVO>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.tencent.devops.auth.resources.user

import com.tencent.devops.auth.api.user.UserAuthAuthorizationResource
import com.tencent.devops.auth.pojo.enum.OperateChannel
import com.tencent.devops.auth.pojo.vo.AuthProjectVO
import com.tencent.devops.auth.pojo.vo.ResourceTypeInfoVo
import com.tencent.devops.auth.service.PermissionAuthorizationService
import com.tencent.devops.auth.service.iam.PermissionResourceValidateService
Expand Down Expand Up @@ -103,4 +104,8 @@ class UserAuthAuthorizationResourceImpl(
)
)
}

override fun listUserProjectsWithAuthorization(userId: String): Result<List<AuthProjectVO>> {
return Result(permissionAuthorizationService.listUserProjectsWithAuthorization(userId))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired
class UserAuthResourceResourceImpl @Autowired constructor(
private val permissionResourceService: PermissionResourceService,
private val permissionResourceValidateService: PermissionResourceValidateService,
private val permissionResourceGroupService: PermissionResourceGroupService,
private val permissionAuthorizationService: PermissionAuthorizationService
private val permissionResourceGroupService: PermissionResourceGroupService
) : UserAuthResourceResource {
override fun hasManagerPermission(
userId: String,
Expand Down Expand Up @@ -189,8 +188,4 @@ class UserAuthResourceResourceImpl @Autowired constructor(
)
)
}

override fun listUserProjectsWithAuthorization(userId: String): Result<List<AuthProjectVO>> {
return Result(permissionAuthorizationService.listUserProjectsWithAuthorization(userId))
}
}

0 comments on commit 34887b5

Please sign in to comment.