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

Commit 38384fa

Browse files
committed
Manage masks
1 parent 671d728 commit 38384fa

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

core/src/plugins/access.ajxp_conf/class.ajxp_confAccessDriver.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,12 @@ public function switchAction($action, $httpVars, $fileVars)
800800
$roleData["ACTIONS"] = $originalRole->listActionsStates();
801801
}
802802

803+
if(isSet($roleData["MASKS"])){
804+
foreach($roleData["MASKS"] as $repoId => $serialMask){
805+
$roleData["MASKS"][$repoId] = new AJXP_PermissionMask($serialMask);
806+
}
807+
}
808+
803809
try {
804810
$originalRole->bunchUpdate($roleData);
805811
if (isSet($userObject)) {
@@ -1530,10 +1536,14 @@ public function switchAction($action, $httpVars, $fileVars)
15301536
$shares = ConfService::getConfStorageImpl()->simpleStoreList("share", null, "", "serial", '', $repId);
15311537
print('<users total="'.$users.'"/>');
15321538
print('<shares total="'.count($shares).'"/>');
1539+
$rootGroup = AuthService::getRole("AJXP_GRP_/");
1540+
if($rootGroup->hasMask($repId)){
1541+
print("<mask><![CDATA[".json_encode($rootGroup->getMask($repId))."]]></mask>");
1542+
}
15331543
print "</additional_info>";
15341544
}
15351545
AJXP_XMLWriter::close("admin_data");
1536-
return ;
1546+
15371547
break;
15381548

15391549
case "edit_repository_label" :
@@ -1623,7 +1633,14 @@ public function switchAction($action, $httpVars, $fileVars)
16231633
return;
16241634
}
16251635
}
1626-
1636+
// TODO : WHAT TO DO FOR SUB ADMINS ?
1637+
if (isSet($httpVars["permission_mask"]) && !empty($httpVars["permission_mask"])){
1638+
$mask = json_decode($httpVars["permission_mask"], true);
1639+
$perm = new AJXP_PermissionMask($mask);
1640+
$rootGroup = AuthService::getRole("AJXP_GRP_/");
1641+
$rootGroup->setMask($repId, $perm);
1642+
AuthService::updateRole($rootGroup);
1643+
}
16271644
ConfService::replaceRepository($repId, $repo);
16281645
}
16291646
AJXP_XMLWriter::header();

0 commit comments

Comments
 (0)