Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Manage masks
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Sep 18, 2015
1 parent 671d728 commit 38384fa
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions core/src/plugins/access.ajxp_conf/class.ajxp_confAccessDriver.php
Expand Up @@ -800,6 +800,12 @@ public function switchAction($action, $httpVars, $fileVars)
$roleData["ACTIONS"] = $originalRole->listActionsStates();
}

if(isSet($roleData["MASKS"])){
foreach($roleData["MASKS"] as $repoId => $serialMask){
$roleData["MASKS"][$repoId] = new AJXP_PermissionMask($serialMask);
}
}

try {
$originalRole->bunchUpdate($roleData);
if (isSet($userObject)) {
Expand Down Expand Up @@ -1530,10 +1536,14 @@ public function switchAction($action, $httpVars, $fileVars)
$shares = ConfService::getConfStorageImpl()->simpleStoreList("share", null, "", "serial", '', $repId);
print('<users total="'.$users.'"/>');
print('<shares total="'.count($shares).'"/>');
$rootGroup = AuthService::getRole("AJXP_GRP_/");
if($rootGroup->hasMask($repId)){
print("<mask><![CDATA[".json_encode($rootGroup->getMask($repId))."]]></mask>");
}
print "</additional_info>";
}
AJXP_XMLWriter::close("admin_data");
return ;

break;

case "edit_repository_label" :
Expand Down Expand Up @@ -1623,7 +1633,14 @@ public function switchAction($action, $httpVars, $fileVars)
return;
}
}

// TODO : WHAT TO DO FOR SUB ADMINS ?
if (isSet($httpVars["permission_mask"]) && !empty($httpVars["permission_mask"])){
$mask = json_decode($httpVars["permission_mask"], true);
$perm = new AJXP_PermissionMask($mask);
$rootGroup = AuthService::getRole("AJXP_GRP_/");
$rootGroup->setMask($repId, $perm);
AuthService::updateRole($rootGroup);
}
ConfService::replaceRepository($repId, $repo);
}
AJXP_XMLWriter::header();
Expand Down

0 comments on commit 38384fa

Please sign in to comment.