final public static function revokePermissions( $role, $permissions ) { $role = trim($role); if ( ! $r = Role::findByName($role) ) return self::__ERROR( __('Role does not exist!') ); foreach (explode(',', $permissions) as $permission) { $permission = trim($permission); if ( $r->hasPermission($permission) ) { if ( ! $p = Permission::findByName($permission) ) return self::__ERROR( __('Permission does not exist!') ); RolePermission::deleteWhere('RolePermission','role_id='.$r->id.', permission_id='.$p->id); if ( RolePermission::countFrom('RolePermission','role_id='.$r->id.', permission_id='.$p->id) > 0 ) return self::__ERROR( __('Could not remove Role->Permission link!') ); } } return true; }