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

Commit

Permalink
Add role_update_right for API access
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Jan 1, 2014
1 parent 25097f7 commit 43b4329
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/src/plugins/access.ajxp_conf/ajxp_confActions.xml
Expand Up @@ -557,6 +557,15 @@
<input_param name="right" type="string" mandatory="true" description="Must be r (read), w (write) or n (none)"/>
</serverCallback>
</processing>
</action>
<action name="role_update_right">
<processing>
<serverCallback methodName="switchAction" restParams="/repository/role_id/right" checkParams="true">
<input_param name="role_id" type="AJXP_ROLE" mandatory="true" description="ID of the role"/>
<input_param name="repository_id" type="AJXP_REPOSITORY" mandatory="true" description="Repository ID"/>
<input_param name="right" type="string" mandatory="true" description="Must be r (read), w (write) or n (none)"/>
</serverCallback>
</processing>
</action>
<action name="get_bookmarks">
<pre_processing>
Expand Down
26 changes: 26 additions & 0 deletions core/src/plugins/access.ajxp_conf/class.ajxp_confAccessDriver.php
Expand Up @@ -693,6 +693,32 @@ public function switchAction($action, $httpVars, $fileVars)

break;

case "role_update_right" :
if(!isSet($httpVars["role_id"])
|| !isSet($httpVars["repository_id"])
|| !isSet($httpVars["right"]))
{
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.61"]);
AJXP_XMLWriter::close();
break;
}
$rId = AJXP_Utils::sanitize($httpVars["role_id"]);
$role = AuthService::getRole($rId);
if($role === false){
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.61"]."(".$rId.")");
AJXP_XMLWriter::close();
break;
}
$role->setAcl(AJXP_Utils::sanitize($httpVars["repository_id"], AJXP_SANITIZE_ALPHANUM), AJXP_Utils::sanitize($httpVars["right"], AJXP_SANITIZE_ALPHANUM));
AuthService::updateRole($role);
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage($mess["ajxp_conf.46"].$httpVars["role_id"], null);
AJXP_XMLWriter::close();

break;

case "user_update_right" :
if(!isSet($httpVars["user_id"])
|| !isSet($httpVars["repository_id"])
Expand Down

0 comments on commit 43b4329

Please sign in to comment.