diff options
author | Chris Cornutt <enygma@phpdeveloper.org> | 2015-07-02 20:43:47 -0500 |
---|---|---|
committer | Chris Cornutt <enygma@phpdeveloper.org> | 2015-07-02 20:43:47 -0500 |
commit | c01b19f506c2819199f55ec710a5e3748d27fd6c (patch) | |
tree | 125b5f6effb0e2e9689a3163c880631af98e48f0 /docs | |
parent | 7727fbab2c7d73a92a665c013ce76fb43487449b (diff) | |
download | gatekeeper-c01b19f506c2819199f55ec710a5e3748d27fd6c.zip gatekeeper-c01b19f506c2819199f55ec710a5e3748d27fd6c.tar.gz gatekeeper-c01b19f506c2819199f55ec710a5e3748d27fd6c.tar.bz2 |
adding expiration to permissions, updating docs
Diffstat (limited to 'docs')
-rw-r--r-- | docs/permissions.md | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/docs/permissions.md b/docs/permissions.md index 682c222..b7820cb 100644 --- a/docs/permissions.md +++ b/docs/permissions.md @@ -25,6 +25,29 @@ if (Gatekeeper::createPermission($perm) === true) { ?> ``` +You can also set an expiration date on your permissions using the `expire` property: + +```php +<?php +$perm = [ + 'name' => 'perm1', + 'description' => 'Permission #1', + 'expire' => strtotime('+1 day') +]; +?> +``` + +These values are stored as Unix timestamps on the permission records themselves. This will cause the permission to exire, **not** the permission to no longer be allowed for a user (that's in the user-to-permission relationship). You can also check to see if a permission is expired with the `isExpired` method: + +```php +<?php +$permission = Gatekeeper::findPermissionById(1); +if ($permission->isExpired() === true) { + echo 'Oh noes, the permission expired!'; +} +?> +``` + ## Adding Child Permissions Much like groups, permissions also support the concept of children. Adding a permission as a child to a parent is easy and can be done in one of two ways: @@ -41,7 +64,7 @@ $permission->addChild($permission); ?> ``` -### Removing Child Permissions +## Removing Child Permissions You can also remove child permissions in a similar way: |