Roles
Introduction
Roles
are used to manage Permissions
in intratool.
The binding of Permissions
to a Role
is done by a pivot table called permission_role
, in which each Permission
of the unique Role
is assigned.
Those Roles
will then get assigned to a Department so that every member of a Department has the same Permissions
unless the Permissions
are not modified for a specific User .
All this data can then be retrieved/created or modified via the Roles
API.
Model Definition
Alias
role
Relations
users
Has many
users.role_id
department
Belongs to
department_id
departments
Has many
departments.role_id
infoboard_departments
Belongs to many
Intermediate table
Permissions
permissions
Belongs to many
Intermediate table
List
Get a list of all Roles
.
Definition
GET
/api/roles
Example Request
Example Response
Show
Show a single Role
by id
.
Definition
GET
/api/roles/{id}
Example Request
Example Response
Create
Create a new Role
.
Definition
POST
/api/roles
Request Keys
department_id
*
integer
-
name
*
string
-
Name of the Role
active
boolean
true
Whether the Role
active
permissions_ids
*
string
-
The granted Permissions
of the Role
department_ids
string
Related Department
infoboard_department_ids
string
Related Department
sort_number
integer
Current highest +1
The index of the Role
Keys with *
are required.
Example Request
Example Response
Update
Update an existing Role
by id
.
Definition
PUT
/api/roles/{id}
Request Keys
department_id
integer
name
string
Name of the Role
active
boolean
Whether the Role
active
permissions_ids
string
The granted Permissions
of the Role
department_ids
string
infoboard_department_ids
string
sort_number
integer
The index of the Role
Example Request
Example Response
Delete
Delete an existing Role
by id
.
Definition
DELETE
/api/roles/{id}
Example Request
Example Response
Last updated