Skip to content

Commit

Permalink
v 0.2.1 r1
Browse files Browse the repository at this point in the history
User::checkGroup 버그 픽스
ModuleHandler accessible_group 관련 버그 픽스
  • Loading branch information
Prev committed Jul 21, 2013
1 parent 1191441 commit f85baa3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
19 changes: 10 additions & 9 deletions lib/classes/ModuleHandler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ static private function loadModule($moduleID) {
'kr' => '모듈을 초기화 할 수 없습니다 - info.json 파일 파싱에 실패했습니다'
));
}
else if (isset($moduleInfo->accessible_group)) {
if (is_null(User::getCurrent()) || User::getCurrent()->checkGroup($moduleInfo->accessible_group)) {
Context::printErrorPage(array(
'en' => 'Cannot initialize module - Operation not permitted',
'kr' => '모듈을 초기화 할 수 없습니다 - 권한이 없습니다'
));
}
}

if (isset($moduleInfo->layout))
Context::getInstance()->setLayout($moduleInfo->layout);
Expand Down Expand Up @@ -154,13 +146,22 @@ static private function loadModuleAction($action, $module) {
$action = $actions[$i]->name;

if ($action == $actions[$i]->name) {
if (isset($actions[$i]->allow_web_access) && $actions[$i]->allow_web_access == false && isset(Context::getInstance()->moduleAction) &&Context::getInstance()->moduleAction == $action){
if (isset($actions[$i]->allow_web_access) && $actions[$i]->allow_web_access == false && isset(Context::getInstance()->moduleAction) && Context::getInstance()->moduleAction == $action){
Context::printErrorPage(array(
'en' => 'Cannot execute module action - web access is not allowed',
'kr' => '모듈 액션을 실행할 수 없습니다 - 웹 접근이 허용되지않음'
));
return NULL;
}
if (isset($actions[$i]->accessible_group)) {
if (is_null(User::getCurrent()) || !User::getCurrent()->checkGroup($actions[$i]->accessible_group)) {
Context::printErrorPage(array(
'en' => 'Cannot initialize module - Operation not permitted',
'kr' => '모듈을 초기화 할 수 없습니다 - 권한이 없습니다'
));
return NULL;
}
}
if (isset($actions[$i]->layout))
Context::getInstance()->setLayout($actions[$i]->layout);
return $actions[$i];
Expand Down
17 changes: 11 additions & 6 deletions lib/classes/User.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,18 @@ public function __construct($data) {

public function checkGroup($groups) {
if (is_array($groups)) {
for ($i=0; $i<count($groups); $i++) {
$p = array_search($this->groups, $groups[$i]);
if ($p !== false) return true;
for ($i=0; $i<count($groups); $i++) {
for ($j=0; $j<count($this->groups); $j++) {
if ($groups[$i] == $this->groups[$j]->name)
return true;
}
}
}else
$p = array_search($this->groups, $groups);
if ($p !== false) return true;
}else {
for ($j=0; $j<count($this->groups); $j++) {
if ($groups == $this->groups[$j]->name)
return true;
}
}
return false;
}
}
2 changes: 2 additions & 0 deletions sso-server/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
for ($i=0; $i < count($groupDatas); $i++) {
$tmp = $groupDatas[$i];
$tmp->name_locales = json_decode($tmp->name_locales);
unset($tmp->id);
unset($tmp->user_id);

array_push($obj->userData->groups, $tmp);
}
Expand Down

0 comments on commit f85baa3

Please sign in to comment.