#285 모듈의 class파일에 isAdmin() method를 추가하여 모듈 개별적으로 관리 권한에 대해 체크할 수 있는 기능을 추가하여 문서 모듈의 경우 게시판 관리자 id로 등록되어 있는지를 확인하여 권한을 부여하도록 기능 추가

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3486 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-01-07 11:46:50 +00:00
parent 72b4680bd1
commit 61176c6538
4 changed files with 101 additions and 9 deletions

View file

@ -176,5 +176,73 @@
**/
function recompileCache() {
}
/**
* @brief 권한 체크를 실행하는 method
* 모듈 객체가 생성된 경우는 직접 권한을 체크하지만 기능성 모듈등 스스로 객체를 생성하지 않는 모듈들의 경우에는
* ModuleObject에서 직접 method를 호출하여 권한을 확인함
*
* isAdminGrant는 관리권한 이양시에만 사용되도록 하고 기본은 false로 return 되도록 하여 잘못된 권한 취약점이 생기지 않도록 주의하여야
**/
function isAdmin() {
// 로그인이 되어 있지 않으면 무조건 return false
$is_logged = Context::get('is_logged');
if(!$is_logged) return false;
// 사용자 아이디를 구함
$logged_info = Context::get('logged_info');
$user_id = $logged_info->user_id;
// 모듈 요청에 사용된 변수들을 가져옴
$args = Context::getRequestVars();
// act의 값에 따라서 관리 권한 체크
switch($args->act) {
// 게시글 목록에서 글을 체크하는 경우 해당 글의 모듈 정보를 구해서 관리자 여부를 체크
case 'procDocumentAdminAddCart' :
if(!$args->srl) return false;
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByDocumentSrl($args->srl);
if(!$module_info) return false;
if(is_array($module_info->admin_id) && in_array($user_id, $module_info->admin_id)) return true;
break;
// 체크된 게시글을 관리하는 action
case 'dispDocumentAdminManageDocument' :
// 세션 정보에 게시글이 담겨 있으면 return true 해줌
$flag_list = $_SESSION['document_management'];
if(count($flag_list)) return true;
break;
// 체크된 게시글을 다른 모듈로 이동 또는 복사, 삭제 할때
case 'procDocumentAdminManageCheckedDocument' :
switch($args->type) {
// 이동과 복사의 경우에는 대상 모듈의 정보를 체크
case 'move' :
case 'copy' :
if($args->target_module) {
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->target_module);
if(!$module_info) return false;
if(is_array($module_info->admin_id) && in_array($user_id, $module_info->admin_id)) return true;
}
break;
// 삭제일 경우는 세션에 저장된 글이 있으면 return true
case 'delete' :
$flag_list = $_SESSION['document_management'];
if(count($flag_list)) return true;
break;
}
break;
}
return false;
}
}
?>