Skip to main content

Internal role object with comprehensive permission and system details

_id
string
required

Unique identifier for the role (MongoDB ObjectId)

Example:

"65c1f68ea735b522d370ea24"

organizationId
string
required

Organization identifier that owns this role

Example:

"65c1f4eeca7c4816d94587b2"

name
string
required

Role display name

Example:

"Field Manager"

permissions
string[]
required

Array of permission strings granted to this role

Example:
[
"task.read",
"task.create",
"task.update",
"user.read",
"vehicle.read",
"hub.read"
]
isActive
boolean
required

Whether this role is currently active

Example:

true

code
string

Role internal code

Example:

"field_manager"

inputType
string

The input type of the component (e.g., string, number, date, etc.)

description
string
permissionGroups
object

Permissions organized by module/feature groups

hubAccess
string[]

Hub IDs this role can access (null means all hubs)

Example:
[
"65c1f68ea735b522d370ea25",
"65c1f68ea735b522d370ea26"
]
flowPermissions
object

Flow-specific permissions configuration

isDeletable
boolean

Whether this role can be deleted (system roles cannot be deleted)

Example:

true

isDefault
boolean

Whether this is a default system role

Example:

false

usersCount
integer

Number of users currently assigned to this role

Example:

15

users
object[]

Users assigned to this role (for internal reference)

hierarchy
object

Role hierarchy information

createdBy
string

Email of admin who created this role

Example:

"admin@mile.app"

updatedBy
string

Email of admin who last updated this role

Example:

"admin@mile.app"

createdTime
string<date-time>

ISO 8601 timestamp when role was created

Example:

"2024-01-05T14:30:00.000000Z"

updatedTime
string<date-time>

ISO 8601 timestamp when role was last updated

Example:

"2024-02-01T10:15:00.000000Z"

internalNotes
string

Internal administrative notes (not visible to public API)

Example:

"Custom role created for regional operations team"

auditLog
object[]

Role permission change audit log

systemMetadata
object

Internal system metadata

failedCode
enum<string>

Role Module business failedCode that indicate specific failure conditions or business rule violations during role module operations. These codes help identify the failed operation of role-related and provide standardized failure identification across the system.

Possible values:

  • role-031: Duplicate entry - Role name already exists
  • role-032: Invalid state/condition - Role state transition invalid
  • role-033: Role not found - Role record does not exist
  • role-034: general failed create role - Failed to create role
  • role-035: Access forbidden - User lacks role permission
  • role-036: general failed delete role - Failed to delete role
  • role-037: Role update failed - Failed to update role
  • role-039: Invalid flow in role permission - Flow permission configuration invalid
  • role-040: Limit exceeded - Role limit per organization exceeded
  • role-041: License limitation - Role feature not in license
  • role-042: Update forbidden (owner role) - Cannot update owner role
  • role-043: Cannot rename owner role - Owner role name protected
  • role-044: Cannot delete default role - Default roles protected
  • role-045: Server failure - Internal server failure
  • role-046: Cannot delete role in use - Role assigned to users
Available options:
role-031,
role-032,
role-033,
role-034,
role-035,
role-036,
role-037,
role-039,
role-040,
role-041,
role-042,
role-043,
role-044,
role-045,
role-046