@@ -80,12 +80,20 @@ public $permissions = [
8080## Assigning Permissions to Groups
8181
8282In order to grant any permissions to a group, they must have the permission assigned to the group, within the ` AuthGroups `
83- config file, under the ` $matrix ` property. The matrix is an associative array with the group name as the key,
83+ config file, under the ` $matrix ` property.
84+
85+ > ** Note** This defines ** group-level permissons** .
86+
87+ The matrix is an associative array with the group name as the key,
8488and an array of permissions that should be applied to that group.
8589
8690``` php
8791public $matrix = [
88- 'admin' => ['admin.access', 'users.create', 'users.edit', 'users.delete', 'beta.access'],
92+ 'admin' => [
93+ 'admin.access',
94+ 'users.create', 'users.edit', 'users.delete',
95+ 'beta.access'
96+ ],
8997];
9098```
9199
@@ -104,8 +112,8 @@ The `Authorizable` trait on the `User` entity provides the following methods to
104112#### can()
105113
106114Allows you to check if a user is permitted to do a specific action. The only argument is the permission string. Returns
107- boolean ` true ` /` false ` . Will check the user's direct permissions first, and then check against all of the user's groups
108- permissions to determine if they are allowed.
115+ boolean ` true ` /` false ` . Will check the user's direct permissions ( ** user-level permissions ** ) first, and then check against all of the user's groups
116+ permissions ( ** group-level permissions ** ) to determine if they are allowed.
109117
110118``` php
111119if ($user->can('users.create')) {
@@ -133,6 +141,10 @@ if (! $user->hasPermission('users.create')) {
133141}
134142```
135143
144+ > ** Note** This method checks only ** user-level permissions** , and does not check
145+ > group-level permissions. If you want to check if the user can do something,
146+ > use the ` $user->can() ` method instead.
147+
136148#### Authorizing via Routes
137149
138150You can restrict access to a route or route group through a
@@ -168,7 +180,7 @@ override the group, so it's possible that a user can perform an action that thei
168180
169181#### addPermission()
170182
171- Adds one or more permissions to the user. If a permission doesn't exist, a ` CodeIgniter\Shield\Authorization\AuthorizationException `
183+ Adds one or more ** user-level ** permissions to the user. If a permission doesn't exist, a ` CodeIgniter\Shield\Authorization\AuthorizationException `
172184is thrown.
173185
174186``` php
@@ -177,7 +189,7 @@ $user->addPermission('users.create', 'users.edit');
177189
178190#### removePermission()
179191
180- Removes one or more permissions from a user. If a permission doesn't exist, a ` CodeIgniter\Shield\Authorization\AuthorizationException `
192+ Removes one or more ** user-level ** permissions from a user. If a permission doesn't exist, a ` CodeIgniter\Shield\Authorization\AuthorizationException `
181193is thrown.
182194
183195``` php
@@ -186,7 +198,7 @@ $user->removePermission('users.delete');
186198
187199#### syncPermissions()
188200
189- Updates the user's permissions to only include the permissions in the given list. Any existing permissions on that user
201+ Updates the user's ** user-level ** permissions to only include the permissions in the given list. Any existing permissions on that user
190202not in this list will be removed.
191203
192204``` php
@@ -195,12 +207,14 @@ $user->syncPermissions('admin.access', 'beta.access');
195207
196208#### getPermissions()
197209
198- Returns all permissions this user has assigned directly to them.
210+ Returns all ** user-level ** permissions this user has assigned directly to them.
199211
200212``` php
201213$user->getPermissions();
202214```
203215
216+ > ** Note** This method does not return ** group-level permissions** .
217+
204218## Managing User Groups
205219
206220#### addGroup()
0 commit comments