Auth.PeopleRoles (auth v1.6.6)

Defines people_roles schema and fuction to grant roles to a person.

Link to this section Summary

Functions

get_by_id!/1 returns the record with the given people_roles.id.

get_record/2 returns the record where the person was granted a role.

get_roles_for_person/1 returns the list of roles for a given person.id

get_roles_for_person_for_app/2 returns the list of roles for a given person.id for the specific app.

insert/4 grants a role to the given person app_id for app the person is granted the role for (always scoped to app!) grantee_id is the person.id of the person being granted the role granter_id is the id of the person (admin) granting the role role_id is the role.id (int, e.g: 4) of th role being granted.

list_people_roles/0 returns the list of people_roles with all people data. This is useful for displaying the data in a admin overview table.

revoke/3 grants a role to the given person revoker_id is the id of the person (admin) granting the role person_id is the person.id of the person being granted the role role_id is the role.id (int, e.g: 4) of th role being granted.

upsert/4 grants a role (role_id) to the given person (grantee_id) for the app_id. granter_id is the id of the person (admin) granting the role.

Link to this section Functions

get_by_id!/1 returns the record with the given people_roles.id.

Link to this function

get_record(person_id, role_id)

get_record/2 returns the record where the person was granted a role.

Link to this function

get_roles_for_person(person_id)

get_roles_for_person/1 returns the list of roles for a given person.id

Link to this function

get_roles_for_person_for_app(app_id, person_id)

get_roles_for_person_for_app/2 returns the list of roles for a given person.id for the specific app.

Link to this function

insert(app_id, grantee_id, granter_id, role_id)

insert/4 grants a role to the given person app_id for app the person is granted the role for (always scoped to app!) grantee_id is the person.id of the person being granted the role granter_id is the id of the person (admin) granting the role role_id is the role.id (int, e.g: 4) of th role being granted.

Link to this function

list_people_roles()

list_people_roles/0 returns the list of people_roles with all people data. This is useful for displaying the data in a admin overview table.

Link to this function

revoke(revoker_id, people_roles_id)

revoke/3 grants a role to the given person revoker_id is the id of the person (admin) granting the role person_id is the person.id of the person being granted the role role_id is the role.id (int, e.g: 4) of th role being granted.

Link to this function

upsert(app_id, grantee_id, granter_id, role_id)

upsert/4 grants a role (role_id) to the given person (grantee_id) for the app_id. granter_id is the id of the person (admin) granting the role.