[pLog-svn] r4112 - plog/trunk/class/dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Mon Oct 9 11:52:34 GMT 2006
Author: oscar
Date: 2006-10-09 11:52:34 +0000 (Mon, 09 Oct 2006)
New Revision: 4112
Modified:
plog/trunk/class/dao/userinfo.class.php
Log:
added an extra method to check permissions based on its name
Modified: plog/trunk/class/dao/userinfo.class.php
===================================================================
--- plog/trunk/class/dao/userinfo.class.php 2006-10-09 11:51:33 UTC (rev 4111)
+++ plog/trunk/class/dao/userinfo.class.php 2006-10-09 11:52:34 UTC (rev 4112)
@@ -314,6 +314,26 @@
return( isset( $this->perms[$blogId][$permission] ));
}
+ function hasPermissionByName( $permName, $blogId )
+ {
+ $ok = false;
+
+ if( !isset($this->perms[$blogId] )) {
+ lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+ $perms = new UserPermissions();
+ $this->perms[$blogId] = $perms->getUserPermissions( $this->getId(), $blogId );
+ }
+
+ foreach( $this->perms[$blogId] as $perm ) {
+ if( $perm->getPermissionName() == $permName ) {
+ $ok = true;
+ break;
+ }
+ }
+
+ return( $ok );
+ }
+
function getPermissions( $blogId )
{
if( !isset($this->perms[$blogId] )) {
@@ -324,6 +344,6 @@
}
return( $this->perms[$blogId] );
- }
+ }
}
?>
More information about the pLog-svn
mailing list