mirror of https://github.com/portainer/portainer
22 lines
535 B
Go
22 lines
535 B
Go
package proxy
|
|
|
|
import "github.com/portainer/portainer"
|
|
|
|
func canUserAccessResource(userID portainer.UserID, userTeamIDs []portainer.TeamID, resourceControl *portainer.ResourceControl) bool {
|
|
for _, authorizedUserAccess := range resourceControl.UserAccesses {
|
|
if userID == authorizedUserAccess.UserID {
|
|
return true
|
|
}
|
|
}
|
|
|
|
for _, authorizedTeamAccess := range resourceControl.TeamAccesses {
|
|
for _, userTeamID := range userTeamIDs {
|
|
if userTeamID == authorizedTeamAccess.TeamID {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|