Skip to main content

Roles

Roles are the fundamental building blocks of the ImageFactory permission system. A Role is a named collection of rules that define what actions a subject can perform on specific resources within a customer's environment.

Role Properties

Every role in ImageFactory consists of the following attributes:

  • Name: A unique identifier for the role within the customer scope.
  • Description: A human-readable explanation of the role's purpose.
  • Rules: An array of Rule objects that define the actual permissions.

Rule Structure

A Rule is composed of two primary lists:

  1. Actions: A list of operations allowed by this rule.
  2. Resources: A list of resource types that the actions can be performed upon.

Permission Enums

To define rules accurately, you must use the supported enum values for actions and resources.

Action Enum Values

ValueDescription
VIEWAllows reading resource details, listing resources, and viewing status.
CREATEAllows provisioning new resources.
UPDATEAllows modifying existing resource configurations.
DELETEAllows removing resources from the system.
ANYA wildcard that grants all of the above permissions.

Resource Enum Values

ValueDescription
ACCOUNTCloud provider credentials and account settings.
API_KEYProgrammatic access keys.
AUDIT_LOGSystem activity records.
COMPONENTImage components and scripts.
NOTIFICATION_GROUPAlerting configurations.
ROLEPermission set definitions.
ROLE_BINDINGAssignments of roles to subjects.
TEMPLATEImage definitions and build configs.
VARIABLESecure secrets and build variables.
ANYA wildcard that covers all resource types.

Example Roles

Here are some common role configurations used in production environments.

Admin Role

The Admin role provides full control over all resources.

{
"name": "CustomerAdmin",
"description": "Full administrative access to all resources.",
"rules": [
{
"actions": ["ANY"],
"resources": ["ANY"]
}
]
}

Read-Only Role

Useful for auditors or team members who only need to monitor status.

{
"name": "ReadOnly",
"description": "View-only access to all resources.",
"rules": [
{
"actions": ["VIEW"],
"resources": ["ANY"]
}
]
}

Template Manager Role

Designed for developers who manage image definitions but shouldn't touch credentials or permissions.

{
"name": "TemplateManager",
"description": "Manage templates and components.",
"rules": [
{
"actions": ["VIEW", "CREATE", "UPDATE", "DELETE"],
"resources": ["TEMPLATE", "COMPONENT", "ACCOUNT"]
},
{
"actions": ["VIEW"],
"resources": ["VARIABLE", "NOTIFICATION_GROUP"]
}
]
}

Managing Roles

To manage roles, navigate to Permissions in the sidebar and select the Roles tab. From here you can view existing roles, create new ones, edit permissions, and delete roles that are no longer needed.

For a detailed walkthrough, see the Permissions guide.

Via API

Roles can also be managed programmatically through the GraphQL API. Below are examples of common operations.

Creating a Role

Use the createRole mutation to define a new permission set.

mutation CreateRole($input: CreateRoleInput!) {
createRole(input: $input) {
id
name
description
rules {
actions
resources
}
}
}

Variables:

{
"input": {
"name": "SecurityAuditor",
"description": "Access to audit logs and resource metadata.",
"rules": [
{
"actions": ["VIEW"],
"resources": ["AUDIT_LOG", "ANY"]
}
]
}
}

Listing Roles

Retrieve all roles defined for the current customer.

query ListRoles {
roles {
id
name
description
}
}

Updating a Role

Modify the rules or description of an existing role.

mutation UpdateRole($id: ID!, $input: UpdateRoleInput!) {
updateRole(id: $id, input: $input) {
id
rules {
actions
resources
}
}
}

Deleting a Role

Remove a role from the system. Note that you cannot delete a role if it is currently referenced by any Role Bindings. You must first remove the bindings before the role can be deleted.

mutation DeleteRole($id: ID!) {
deleteRole(id: $id)
}