Last active
November 25, 2019 06:44
-
-
Save andiskiy/b6a8b78d69c5b891ff44c7646b7fbd6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
users table: | |
Table Users { | |
Id, | |
Name | |
} | |
1. Policies | |
an example of: | |
reboot_system - "Allow user to reboot system", | |
write_to_file - "Allow user write files", | |
delete_files - "Allow user delete files", | |
change_user_prefernces - "Allow user to edit other users" | |
Table Policies { | |
Id, | |
Name, | |
Description | |
} | |
2. UserPolicies | |
Table UserPolicies { | |
Id, | |
UserId, // this is a foreign key to User | |
PolicyId // this is a foreign key to Policy | |
} | |
3. Roles | |
Table Roles { | |
Id, | |
Type, | |
PolicyId // this is a foreign key to Policy | |
} | |
4. UserRoles | |
Table UserPolicies { | |
Id, | |
UserId, // this is a foreign key to User | |
RoleId // this is a foreign key to Role | |
} | |
5. Methods | |
function CreateUser('Andrew'): ObjectUser; | |
function CreatePolicy(write_to_file, "Allow user write files"): ObjectPolicy; | |
function CreateRole('moderator', ObjectPolicy): ObjectRole; | |
function SetRole(ObjectRole, ObjectUser): boolean; | |
function SetPolicy(ObjectPolicy, ObjectUser): boolean; | |
function DeleteRole(ObjectRole, ObjectUser): boolean; | |
function DeletePolicy(ObjectPolicy, ObjectUser): boolean; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment