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 /src | |
parent | 7727fbab2c7d73a92a665c013ce76fb43487449b (diff) | |
download | gatekeeper-c01b19f506c2819199f55ec710a5e3748d27fd6c.zip gatekeeper-c01b19f506c2819199f55ec710a5e3748d27fd6c.tar.gz gatekeeper-c01b19f506c2819199f55ec710a5e3748d27fd6c.tar.bz2 |
adding expiration to permissions, updating docs
Diffstat (limited to 'src')
-rw-r--r-- | src/Psecio/Gatekeeper/PermissionModel.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Psecio/Gatekeeper/PermissionModel.php b/src/Psecio/Gatekeeper/PermissionModel.php index 89f79a8..da9a04f 100644 --- a/src/Psecio/Gatekeeper/PermissionModel.php +++ b/src/Psecio/Gatekeeper/PermissionModel.php @@ -49,6 +49,11 @@ class PermissionModel extends \Psecio\Gatekeeper\Model\Mysql 'column' => 'updated', 'type' => 'datetime' ), + 'expire' => array( + 'description' => 'Expiration Date', + 'column' => 'expire', + 'type' => 'datetime' + ), 'children' => array( 'description' => 'Child Permissions', 'type' => 'relation', @@ -103,4 +108,14 @@ class PermissionModel extends \Psecio\Gatekeeper\Model\Mysql ); return $this->getDb()->delete($childPermission); } + + /** + * Test if the permission is expired + * + * @return boolean Expired/not expired + */ + public function isExpired() + { + return ($this->expire !== null && $this->expire >= time()); + } }
\ No newline at end of file |