Skip to content

Commit

Permalink
Add display name for permission roles and use it in ListRoles
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
  • Loading branch information
rdimitrov committed Jun 14, 2024
1 parent b351409 commit b50b39f
Show file tree
Hide file tree
Showing 6 changed files with 866 additions and 839 deletions.
1 change: 1 addition & 0 deletions docs/docs/ref/proto.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions internal/authz/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,24 @@ const (
var (
// AllRoles is a list of all roles
AllRoles = map[Role]string{
AuthzRoleAdmin: "The admin role allows the user to perform all actions on the project and " +
AuthzRoleAdmin: "The Admin role allows the user to perform all actions on the project and " +
"sub-projects.",
AuthzRoleEditor: "The editor role allows for more write and read actions on the project and " +
AuthzRoleEditor: "The Editor role allows for more write and read actions on the project and " +
"sub-projects except for project administration.",
AuthzRoleViewer: "The viewer role allows for read actions on the project and sub-projects.",
AuthzRolePolicyWriter: "The policy_writer role allows for writing policies (rule types and " +
AuthzRoleViewer: "The Viewer role allows for read actions on the project and sub-projects.",
AuthzRolePolicyWriter: "The Policy Writer role allows for writing policies (rule types and " +
"profiles) on the project and sub-projects. This is handy for CI jobs.",
AuthzRolePermissionsManager: "The permissions_manager role allows for managing permissions " +
AuthzRolePermissionsManager: "The Permissions Manager role allows for managing permissions " +
"on the project and sub-projects.",
}
// AllRolesDisplayName is a list of all roles with their display names
AllRolesDisplayName = map[Role]string{
AuthzRoleAdmin: "Admin",
AuthzRoleEditor: "Editor",
AuthzRoleViewer: "Viewer",
AuthzRolePolicyWriter: "Policy Writer",
AuthzRolePermissionsManager: "Permissions Manager",
}
)

func (r Role) String() string {
Expand Down
1 change: 1 addition & 0 deletions internal/controlplane/handlers_authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ func (*Server) ListRoles(_ context.Context, _ *minder.ListRolesRequest) (*minder
for role, desc := range authz.AllRoles {
resp.Roles = append(resp.Roles, &minder.Role{
Name: role.String(),
DisplayName: authz.AllRolesDisplayName[role],
Description: desc,
})
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/openapi/minder/v1/minder.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b50b39f

Please sign in to comment.