Browse Source

fixed sort items to preserve keys in Access acl

Piotr Labudda 9 years ago
parent
commit
cefa36dd57

+ 2 - 2
SE/se-lib/Schema/AccessGroupStorageAcl.php

@@ -60,7 +60,7 @@ class Schema_AccessGroupStorageAcl extends Core_AclBase {// Read only class
     foreach ($userLdapGroups as $vLdapGroup) {
       $allowGroup = false;
       if ('workgroup' == $vLdapGroup->cn) {
-        $items[1] = ['id'=>'0', 'name'=>$vLdapGroup->name, 'uid'=>$vLdapGroup->cn];
+        $items[0] = ['id'=>'0', 'name'=>$vLdapGroup->name, 'uid'=>$vLdapGroup->cn];
       } else {
         $cnTest = str_replace('-', '_', $vLdapGroup->cn);
         $cnTest = explode('_', $cnTest);
@@ -128,7 +128,7 @@ class Schema_AccessGroupStorageAcl extends Core_AclBase {// Read only class
     $orderDir = strtolower(V::get('order_dir', 'desc', $params));
     if (!in_array($orderBy, ['id', 'name', 'uid'])) throw new HttpException("Bad Request - wrong or missing order by", 400);
     if (!in_array($orderDir, ['desc', 'asc'])) throw new HttpException("Bad Request - wrong or missing order dir", 400);
-    usort($items, function ($a, $b) use ($orderBy, $orderDir) {
+    uasort($items, function ($a, $b) use ($orderBy, $orderDir) {
       if ('desc' == $orderDir) {
         return (V::geti($orderBy, '', $a) > V::geti($orderBy, '', $b)) ? -1 : 1;
       } else if ('asc' == $orderDir) {

+ 1 - 1
SE/se-lib/Schema/AccessOwnerStorageAcl.php

@@ -110,7 +110,7 @@ class Schema_AccessOwnerStorageAcl extends Core_AclBase {
     $orderDir = strtolower(V::get('order_dir', 'desc', $params));
     if (!in_array($orderBy, ['id', 'login', 'name'])) throw new HttpException("Bad Request - wrong or missing order by", 400);
     if (!in_array($orderDir, ['desc', 'asc'])) throw new HttpException("Bad Request - wrong or missing order dir", 400);
-    usort($items, function ($a, $b) use ($orderBy, $orderDir) {
+    uasort($items, function ($a, $b) use ($orderBy, $orderDir) {
       if ('desc' == $orderDir) {
         return (V::geti($orderBy, '', $a) > V::geti($orderBy, '', $b)) ? -1 : 1;
       } else if ('asc' == $orderDir) {