![]() |
Myth Auth - Working with groups and permissions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Myth Auth - Working with groups and permissions (/showthread.php?tid=79482) Pages:
1
2
|
Myth Auth - Working with groups and permissions - rafinhaa - 06-22-2021 Any documentation on how to deploy groups and permissions using myth? I inserted this data into the auth_groups table: ID | Name | Description 1 | Admin | Admin 2 | Member | Member auth_groups_users group_id | user_id 1 | 1 2| 2 auth_groups_permissions group_id | permission_id 1 | 1 auth_permissions id | name | description 1| admin | admin I have two users: 1 = Admin 2 = Member Routes: PHP Code: $routes->group('/', ['filter' => 'login'], function($routes){ but the administrator when accessing the route users says he doesn't have permission RE: Myth Auth - Working with groups and permissions - paliz - 06-23-2021 How do you ceck premission s Use filter or check in controller!? I would recoment use filter before any action post get put delete RE: Myth Auth - Working with groups and permissions - InsiteFX - 06-23-2021 auth_helper PHP Code: has_permission($permission) RE: Myth Auth - Working with groups and permissions - rafinhaa - 06-23-2021 I found this inside the repository https://github.com/lonnieezell/myth-auth/blob/develop/docs/authorization.md What I understood so far is: role=group permission=group permission RE: Myth Auth - Working with groups and permissions - paliz - 06-23-2021 It has premission for user tooo You can use rule base or prmission yatem to access Look at filters you ll see RE: Myth Auth - Working with groups and permissions - rafinhaa - 06-23-2021 I've looked at the filters but it seems to only work with groups not users. PHP Code: $authorize = service('authorization'); I didn't find anything specific to work with users, but in the database there is a table called "auth_users_permissions" I will keep doing some tests RE: Myth Auth - Working with groups and permissions - paliz - 06-23-2021 Are sure i tested it work for user permissions too RE: Myth Auth - Working with groups and permissions - ikesela - 06-24-2021 for role, you need to set role in auth_groups, then add user to auth_group_users auth_groups 1 | admin 2 | member auth_group_users group_id | user_id 1 | 1 2 | 2 this 2, enough for setting role in filter for permission, set permission in auth_permissions , then add user to auth_user_permissions (for user) or auth_groups_permissions (for group) RE: Myth Auth - Working with groups and permissions - rafinhaa - 06-24-2021 (06-23-2021, 11:00 PM)paliz Wrote: Are sure i tested it work for user permissions too which version did you use?, i am using release 1 ikesela Wrote:...then add user to auth_user_permissions (for user)... So am I required to declare a group and give permissions to it and then to the user? I wanted it to be user-only without having to put him in a group. RE: Myth Auth - Working with groups and permissions - manager - 06-25-2021 (06-24-2021, 06:40 AM)rafinhaa Wrote: So am I required to declare a group and give permissions to it and then to the user?Myth Auth operates with many concepts such groups (roles) and permissions. User may belong to some single group or groups. Groups = Roles. After registration process if $defaultUserGroup variable in config file is empty (no default group), then user will not belong to any group. To work with permissions you need create them first and set some to the user. Then you can call methods to check user has permission and do some logic. |