Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/cluster/projectroletemplatebinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ func (p *ProjectRoleTemplateBinding) Mutate(clusterName, projectName string) {
}

func (p *ProjectRoleTemplateBinding) SetDescription(ctx context.Context, client *client.Clients) error {
if p.Obj.UserName == "" && p.Obj.UserPrincipalName == "" {
groupName := p.Obj.GroupName
if groupName == "" {
// handling external auth providers
groupName = p.Obj.GroupPrincipalName
}
p.Description = fmt.Sprintf("%s permission for group %s", p.Obj.RoleTemplateName, groupName)
return nil
}
// setting description for external users
if p.Obj.UserPrincipalName != "" {
p.Description = fmt.Sprintf("%s permission for user %s", p.Obj.RoleTemplateName, p.Obj.UserPrincipalName)
return nil
}
var user v3.User
userID := p.Obj.UserName
if err := client.Users.Get(ctx, "", userID, &user, v1.GetOptions{}); err != nil {
Expand Down