mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 17:51:40 +09:00
issue 2363 create get grant method by xml api
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11206 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
aa429a63b4
commit
ff608c540a
4 changed files with 75 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
<module>
|
||||
<grants />
|
||||
<permissions>
|
||||
<permission action="getApiGroups" target="manager" />
|
||||
</permissions>
|
||||
<actions>
|
||||
<action name="dispMemberInfo" type="view" standalone="true" />
|
||||
|
|
@ -36,6 +37,7 @@
|
|||
<action name="getMemberAdminColorset" type="model" standalone="true" />
|
||||
<action name="getMemberAdminInsertJoinForm" type="model" />
|
||||
<action name="getMemberAdminIPCheck" type="model" standalone="true" />
|
||||
<action name="getApiGroups" type="model" standalone="true" />
|
||||
|
||||
<action name="procMemberLogin" type="controller" standalone="true" ruleset="@login" />
|
||||
<action name="procMemberLogout" type="controller" standalone="true" />
|
||||
|
|
|
|||
|
|
@ -478,6 +478,14 @@
|
|||
return $GLOBALS['__group_info__'][$site_srl];
|
||||
}
|
||||
|
||||
public function getApiGroups()
|
||||
{
|
||||
$siteSrl = Context::get('siteSrl');
|
||||
$groupInfo = $this->getGroups($siteSrl);
|
||||
|
||||
$this->add($groupInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a list of member join forms
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<grants />
|
||||
<permissions>
|
||||
<permission action="dispModuleSelectList" target="member" />
|
||||
<permission action="getModuleAdminGrant" target="manager" />
|
||||
</permissions>
|
||||
<actions>
|
||||
<action name="dispModuleSelectList" type="view" standalone="true" />
|
||||
|
|
@ -33,6 +34,7 @@
|
|||
<action name="getLangListByLangcodeForAutoComplete" type="model" standalone="true" />
|
||||
<action name="getFileBoxListHtml" type="model" />
|
||||
<action name="getLangByLangcode" type="model" />
|
||||
<action name="getModuleAdminGrant" type="model" />
|
||||
|
||||
<action name="procModuleAdminInsertCategory" type="controller" standalone="true" ruleset="insertCategory" />
|
||||
<action name="procModuleAdminUpdateCategory" type="controller" standalone="true" ruleset="updateCategory" />
|
||||
|
|
|
|||
|
|
@ -153,6 +153,69 @@
|
|||
return $oTemplate->compile($this->module_path.'tpl', 'module_grants');
|
||||
}
|
||||
|
||||
public function getModuleAdminGrant()
|
||||
{
|
||||
$targetModule = Context::get('target_module');
|
||||
$moduleSrl = Context::get('module_srl');
|
||||
if(!$targetModule || !$moduleSrl)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$xmlInfo = $oModuleModel->getModuleActionXml($targetModule);
|
||||
|
||||
// Grant virtual permission for access and manager
|
||||
$grantList->access->title = Context::getLang('grant_access');
|
||||
$grantList->access->default = 'guest';
|
||||
if(count($xmlInfo->grant))
|
||||
{
|
||||
foreach($xmlInfo->grant as $key => $val)
|
||||
{
|
||||
if(!$val->default) $val->default = 'guest';
|
||||
if($val->default == 'root') $val->default = 'manager';
|
||||
$grantList->{$key} = $val;
|
||||
}
|
||||
}
|
||||
$grantList->manager->title = Context::getLang('grant_manager');
|
||||
$grantList->manager->default = 'manager';
|
||||
|
||||
// Get a permission group granted to the current module
|
||||
$defaultGrant = new stdClass();
|
||||
$args->module_srl = $moduleSrl;
|
||||
$output = executeQueryArray('module.getModuleGrants', $args);
|
||||
if($output->data)
|
||||
{
|
||||
foreach($output->data as $val)
|
||||
{
|
||||
if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
|
||||
else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
|
||||
else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
|
||||
else {
|
||||
$selectedGroup->{$val->name}[] = $val->group_srl;
|
||||
$defaultGrant->{$val->name} = 'group';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(is_object($grantList))
|
||||
{
|
||||
foreach($grantList AS $key=>$value)
|
||||
{
|
||||
if(isset($defaultGrant->{$key}))
|
||||
{
|
||||
$grantList->{$key}->grant = $defaultGrant->{$key};
|
||||
}
|
||||
if(isset($selectedGroup->{$key}))
|
||||
{
|
||||
$grantList->{$key}->group = $selectedGroup->{$key};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->add('grantList', $grantList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Common:: skin setting page for the module
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue