diff options
author | Chris Cornutt <enygma@phpdeveloper.org> | 2015-06-06 17:39:02 -0500 |
---|---|---|
committer | Chris Cornutt <enygma@phpdeveloper.org> | 2015-06-06 17:39:02 -0500 |
commit | 0d69fade9c947ee47dc3e88bd6f0c6272f1f676e (patch) | |
tree | ac3d0a031c0b111e2c1eddaebb90737098cff3a7 /docs | |
parent | ec8270b72480c708f3d553a145a6330005840434 (diff) | |
download | gatekeeper-0d69fade9c947ee47dc3e88bd6f0c6272f1f676e.zip gatekeeper-0d69fade9c947ee47dc3e88bd6f0c6272f1f676e.tar.gz gatekeeper-0d69fade9c947ee47dc3e88bd6f0c6272f1f676e.tar.bz2 |
Adding docs for the hasPermission method on the User (references issue #10)
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/users.md b/docs/users.md index d20ea24..0ee2e51 100644 --- a/docs/users.md +++ b/docs/users.md @@ -183,6 +183,21 @@ if (Gatekeeper::findUserById($userId)->revokeGroup($groupId) === true) { ?> ``` +## Checking to see if a user has a permission + +You can check the user's immediate permissions (not the ones on groups they belong to) with the `hasPermission` method: + +```php +<?php +$permissionId = 1; +if (Gatekeeper::findUserById($userId)->hasPermission($permissionId) === true) { + echo "They've got it!"; +} +?> +``` + +You'll need to have the `id` value for the permission you want to check and provide that as the parameter in the call. + ## Get a list of user permissions You can use the `permissions` property to get the full set of user permissions. These are the permissions **directly assigned** to the user, not to any groups they may be a part of: |