access control 에 해당하는 글 : 1 개
삽질기가 너무 썰렁하여 MoniWiki에 써 놓았던 것을 여기에 옮겨 옴 -.-;;


A2
: 다음의 방법은 어떨까요. 각 페이지에 #private이라는 instruction을 넣음으로써 개인적인 페이지로 설정하는 방법입니다. 대충 말하자면 #private이라는 instruction이 있는 페이지는 read_private이라는 permission이 있어야 볼 수 있도록 하는 방식입니다.

wiki.php에서 대충 다음 부분을 찾아서 고칩니다. (#inserted부터 #end of inserted까지를 삽입합니다.)

$formatter->pi=$formatter->get_instructions($dum);
if ($DBInfo->body_attr)
$options['attr']=$DBInfo->body_attr;

# inserted by Lbird. supporting private pages
if ($formatter->pi['#private'] and !$DBInfo->security->is_allowed('read_private',$options)) {
do_invalid($formatter,$options);
return;
}
# end of inserted code by Lbird.

$formatter->send_header("",$options);

$formatter->send_title("","",$options);
주의: 긴줄이라 잘려서 보일 수 있으니 마우스로 긁어서 어딘가에 붙여 넣어서
봐야 할지도 모름 -.-;; (스킨을 바꿀까 -.-;;)

역시 wiki.php에서 다음 부분도 찾아서 고칩니다. (#private 하나를 추가합니다.)
function get_instructions(&$body) {
global $DBInfo;
# '#private' inserted by Lbird
$pikeys=array('#redirect','#action','#title','#keywords','#noindex',
'#filter','#postfilter','#twinpages','#notwins','#nocomment',
'#language','#camelcase','#nocamelcase',
'#singlebracket','#nosinglebracket','#private');
$pi=array();


#private 이라는 instruction이 들어가 있는 페이지들만 영향을 받습니다. acl.default.php 파일에서
* @ALL deny *
* @ALL allow read,ticket,savepage
* @User allow *

와 같이 되어 있는 경우라면 로그인한 사용자들은 read_private이 있고, guest는 없습니다. read permission만 있으니까 #private이 붙어 있지 않은 페이지들만 읽을 수 있습니다. 더 세세한 설정을 위해서는 특정 그룹을 지정해서 그 그룹에만 read_private 퍼미션을 줄 수도 있을 겁니다.

사족: 위키에 read 퍼미션을 제한한다는 게 위키정신에는 맞지 않는다고 개발자께서 생각하시는데 굳이 저런 걸 하려고 해서 참 죄송하군요. :) -- Lbird
  
트랙백   |  댓글   |
 이전  1   다음 

최근댓글
fotowall :: ncloud RSS Feeds today :    yesterday :
total :