Skip to content

Instantly share code, notes, and snippets.

@sunloverz
Last active December 12, 2018 10:06
Show Gist options
  • Save sunloverz/17ad1b3666c93baca535d39c5f5ab4c0 to your computer and use it in GitHub Desktop.
Save sunloverz/17ad1b3666c93baca535d39c5f5ab4c0 to your computer and use it in GitHub Desktop.
Database tables:
Users {
id
name
}
Roles {
id
name
description
}
UserRoles {
id
user_id
role_id
}
Permissions {
id
name
type
}
RolePermission {
id
role_id
permission_id
}
UserPermission {
id
user_id
permission_id
}
A list of functions:
## Grant permissions to user via role
function RegisterRole(name, description)
function GrantPermission(role, name, type)
function AssignRoleToUser(user, role)
## Grant permissions to a user
function GrantPermission(user, name, type)
## Check permission
function CheckPermission(User, permission_type)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment