|
1 | | -# Security |
| 1 | +import Link from 'next/link'; |
| 2 | +import { Wrench, LockKey, LockSimple } from '@phosphor-icons/react/dist/ssr'; |
| 3 | +import Alert from '@/components/Alert'; |
| 4 | + |
| 5 | +# Security |
| 6 | + |
| 7 | +Security is one of the most important parts of any system. Almost all forumify components have security built into them. |
| 8 | + |
| 9 | +forumify has 2 different ways of securing components, pages, entities,... |
| 10 | + |
| 11 | +- Access Control Lists: defined by entities, controls individual fine-grained access for each "action" per role and per item. |
| 12 | +- Role Permissions: defined statically by the platform or plugins, controls access to larger sections or entire components. |
| 13 | + |
| 14 | +## Roles |
| 15 | + |
| 16 | +Everyone visiting your website is given a role. Even users who are not logged in will have the "Guest" role. |
| 17 | + |
| 18 | +Users can have multiple roles. All permissions and ACLs from all the roles the user have are merged together to define what the user can or cannot do. |
| 19 | + |
| 20 | +### Managing roles |
| 21 | + |
| 22 | +You can manage roles in the <Link href="/user-manual/admin-panel">Admin Panel</Link>. |
| 23 | +You can find them under <Wrench /> Settings -> <LockKey /> Roles. |
| 24 | + |
| 25 | +<Alert severity="warning"> |
| 26 | + Security is a complicated topic. It's best practice to have a second account you can use to test and verify the setup of your roles before assigning any |
| 27 | + real users to them. A misconfiguration of roles could lead to accidentally leaking sensitive data, griefing, or even a total loss of control over your website. |
| 28 | +</Alert> |
| 29 | + |
| 30 | +When creating a role, you can give it a title, and it is highly recommended to give them a description. |
| 31 | + |
| 32 | +Optionally, you can enable the "Administrator" checkbox. Enabling this setting will grant access to the admin panel for all users with this role. |
| 33 | +This checkbox does not grant the user permissions to do anything within the admin panel, the different components are still protected by permissions. |
| 34 | + |
| 35 | +On the role form, in the tab "Permissions", you can assign permissions to the role. The platform, and each plugin that defines permissions, are separated by tabs. |
| 36 | +These permissions are typically meant to (dis)allow access to entire components. For example, if you want to give access to the admin panel to a certain role, |
| 37 | +but only to manage badges, you only select "view" and "manage" under "Settings" -> "Badges". |
| 38 | + |
| 39 | +Finally, to add or remove roles from a user, you have to edit the user. You can then manage their roles using the Roles input. |
| 40 | + |
| 41 | +<Alert severity="info"> |
| 42 | + Roles use a simple 1 dimensional hiearchy. Meaning that you can only assign roles that are equal-or-below your own role. Roles can be sorted using the |
| 43 | + arrows in front of the rows in the Roles table. |
| 44 | +</Alert> |
| 45 | + |
| 46 | + |
| 47 | +### System roles |
| 48 | + |
| 49 | +There are 3 roles within forumify that can not be deleted or modified: |
| 50 | + |
| 51 | +- **Super Admin**: The Super Admin role bypasses any and all security checks. |
| 52 | +It's the most powerful role in your system and should be treated with extreme care. |
| 53 | +Only the website's owner should have this role. It is given to the user who installed the platform. |
| 54 | +- **User**: The User role is automatically assigned to any user that is logged in. |
| 55 | +- **Guest**: The Guest role is automatically assigned to any user that is *not* logged in. |
| 56 | + |
| 57 | +So if you want to grant access to **all** users, all you have to do is assign the permission to both *User* and *Guest* roles. |
| 58 | + |
| 59 | +## ACL (Access Control Lists) |
| 60 | + |
| 61 | +The most common security mechanism you will see in action is ACL. ACL allows you to enable an action for each role. |
| 62 | + |
| 63 | +ACLs are not managed in the Role's setting, but they are managed in the entity that defines them. |
| 64 | +Usually when you see a <LockSimple /> button, you are editing the access control for that entity. |
| 65 | +Entities that are governed by ACLs define their own permissions. |
| 66 | +For example, a forum defines the permissions "view", "create topic", "create comment",... |
| 67 | + |
0 commit comments