Gy - php framework/CMS | Documentation | User group

<-- table of contents

Groups of users

Each user can belong to several user groups. Each group gives permission for certain actions in the system (user actions).

In the admin panel, you can go to -> "Users", and then click "change" with the necessary user, and there will be the setting "Rights Group:", where you can choose which user groups the changed user belongs to.

You can also customize or create new user groups. This can be done in the admin panel -> "Users", then the button "setting permissions groups". On the page that opens, you can change the existing groups and create new ones; at the same time, custom actions are set for the groups. These actions are specified when installing the modules (when this will be implemented) and there are always a certain number of them in the system (the user cannot set new ones or delete them).

Currently there are actions:


An example of working with groups in code

To work with groups, the accessUserGroup class was created (gy/classes/accessUserGroup.php) which contains all the necessary methods.

For example, on the admin pages to check if the current user is allowed to view the admin panel

accessUserGroup::accessThisUserByAction( 'show_admin_panel')

т.е. show_admin_panel - is a user action that allows you to view the admin panel.

Further, if on the admin page we are talking about changing users, then you need to check whether this action is available to the current user:

accessUserGroup::accessThisUserByAction( 'edit_users')

View documentation on