コード例 #1
0
 function getById($id) {
     SecurityPermission::requirePermission("VIEW");
     $sql = "SELECT * from security_permission WHERE id=".Database::sqlValue($id);
     $result = Database::query($sql);
     $r = NULL;
     if ($line = $result->next()) {
         $r = SecurityPermission::build($line);
     }
     return $r;
     
 }
コード例 #2
0
ファイル: SecurityGroup.php プロジェクト: elecnix/smellyfish
 function getPermissions($resource) {
     SecurityGroup::requirePermission("VIEW");
     $resource_id = $resource->getId();
     $sql = "SELECT security_permission.*
         FROM security_resource, security_permission, security_group_permission
         WHERE security_group_permission.group_id=".Database::sqlValue($id)."
         AND security_resource.id=".Database::sqlValue($resource_id)."
         AND security_group_permission.resource_id = security_resource.id
         AND security_group_permission.permission_id = security_permission.id";
     $result = Database::query($sql);
     $perms = array();
     while ($line = $result->next()) {
         array_push($perms, SecurityPermission::build($line));
     }
     return $perms;
 }