Skip to main content

Authorisation

Authorisation happens during various restricted processes or routes within the Web Application, we would like to limit who gets to see or do what.

When those part of the code has been invoked, we would need to check who is the user. This means that it needs to receive an authenticated session token.

Once we have a user, we would then query if the required permission is available.

There are different classes of permission.

1. Accessing specific resource.

In this example, it will only retrieved the active user information.

if user.notPermittedTo("service-get-my-user-name") {
// error handling and returns.
return;
}
// continue to retrieve and return result

2. Accessing specific resource granted to the user.

const requiredPermission = `resource-get-${resourceId}`;
if user.notPermittedTo(requiredPermission) {
// error handling and returns.
return;
}
// continue to retrieve and return result
const requiredPermission = `resourceGroup-get-${resourceGroupId}`;
if user.notPermittedTo(requiredPermission) {
// error handling and returns.
return;
}
// continue to retrieve and return result

3. Accessing every resource granted to the user. This is for admin only.

const requiredPermission = `resourceGroup-get-${resourceId}`;
if user.notPermittedTo(requiredPermission) {
// error handling and returns.
return;
}
// continue to retrieve and return result

There is a Role called basic-user.

Role is implemented as a ResourceGroup

It has

  • permission to read basic information from his own account.
  • permission to respond to group invites or request to join groups.

All newly signed in User will be granted this role.

Resource

Document IDDescriptorDescription
R001service-get-my-user-nameYour own name
R002service-get-my-user-profile-pictureYour own profile picture
R003service-list-my-received-group-inviteList received group invitations
R004service-create-my-join-group-requestsSubmit request to join a group
R005service-list-my-available-appsList assigned apps
R006service-super-adminDo anything. LCRUD on all available routes.
R007application-super-adminAccess all available applications.

ResourceGroup

Document IDDescriptorList of resourcesDescription
RG001role-basic-userR001,R002,R003,R004Default role after user logged in for the first time.
RG002role-super-adminR006,R007Super admin.

UserGroup


AccessControlList

Document IDDescription
ACL001Description

Application

Document IDNameDescription
A001Database AdminDatabase administration console.