1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

feat(ACI): add UAC to ACI

This commit is contained in:
Felix Han 2021-03-30 10:58:56 +13:00
parent ad2910f3f0
commit e3e7e84821
18 changed files with 410 additions and 18 deletions

View file

@ -160,9 +160,13 @@ func FilterAuthorizedCustomTemplates(customTemplates []portainer.CustomTemplate,
return authorizedTemplates
}
// UserCanAccessResource will valide that a user has permissions defined in the specified resource control
// UserCanAccessResource will valid that a user has permissions defined in the specified resource control
// based on its identifier and the team(s) he is part of.
func UserCanAccessResource(userID portainer.UserID, userTeamIDs []portainer.TeamID, resourceControl *portainer.ResourceControl) bool {
if resourceControl == nil {
return false
}
for _, authorizedUserAccess := range resourceControl.UserAccesses {
if userID == authorizedUserAccess.UserID {
return true