쿠폰 모듈의 내 쿠폰 리스트를 특정 그룹에게만 view 할 수 있게하는 방법?
CMS/프레임워크 | XE 1.x |
---|---|
개발 언어 | PHP 5.x |
https://github.com/wincomi/xe-module-coupon
쿠폰 모듈을 사용하고 있는데요
내주소/index.php?act=dispCouponBox&mid=coupon
로 해서 내 쿠폰리스트를 확인할 수 있습니다.
특정 그룹에게만 쿠폰 리스트를 확인할 수 있게 권한 부여를 할 수 있을까요?
coupon.view.php 에서
function coupon() {
// 권한 체크
if(!Context::get('is_logged')) return $this->dispCouponMessage('msg_need_login');
$code = htmlspecialchars(Context::get('code'));
if($code && strlen($code) != 17) return $this->makeObject(-1, 'msg_invalid_request');
Context::setBrowserTitle(Context::getLang('cmd_use_coupon'));
// 레이아웃을 팝업으로 지정
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
$this->setTemplateFile('coupon');
}
function dispCouponBox() {
// 권한 체크
if(!Context::get('is_logged')) return $this->dispCouponMessage('msg_need_login');
$oModel = &getModel('coupon');
$logged_info = Context::get('logged_info');
$args = new stdClass();
$args->member_srl = $logged_info->member_srl;
$args->sort_index = 'regdate';
$args->order_type = 'desc';
$args->page = Context::get('page');
$args->page_count = 10;
$args->list_count = 20;
$output = $oModel->getMemberCouponList($args);
Context::set('coupon_list', $output->data);
// 템플릿 파일 지정
$this->setTemplateFile('coupon_box');
}
이 부분을 보고 있는데 여기 수정하는것이 맞는지요?
미리 답변 감사드립니다.
댓글 5
실제로 모듈에서 권한을 채크하는 기능을 만들려면 메뉴얼을 보시고 만드셔야 합니다.
https://github.com/rhymix/rhymix/blob/master/modules/board/conf/module.xml#L3
https://github.com/rhymix/rhymix/blob/master/modules/board/board.view.php#L132
이 두부분 확인해보시면서 어떻게 권한을 어디에서 처리하는지 한번 다른 모듈을 참고하시기 바랍니다.
module.xml 파일에서 처리하는 권한 사항은 name="" 에 선언한 이름과 php파일에서 선언한 grant->~~~ 와 일치합니다.
그 권한의 경우 mid생성되어있을때만 사용이 가능한 것이고 윗 링크의 모듈처럼 구현하셔야 정확하게 권한을 구현할 수 있습니다.
그냥 그룹이 아닌 로그인한 유저는 다 접근 가능하게 해보려고 하는데요
다만
내주소/index.php?module=coupon 으로 접속하면 로그인한 유저 모두 잘 들어옵니다.
그런데 dispCouponBox 로 들어온 유저만 특정 그룹핑 된 멤버만 받아들이고 있네요
한번 봐주시면 감사하겠습니다.
<module>
<grants />
<permissions >
<permission action="dispCouponBox" target="member" />
<permission action="coupon" target="member" />
</permissions>
<actions>
<action name="dispCouponAdminSetup" type="view" standalone="true" />
<action name="dispCouponAdminList" type="view" standalone="true" admin_index="true" />
<action name="dispCouponAdminCouponLogList" type="view" standalone="true" />
<action name="dispCouponAdminCouponInfo" type="view" standalone="true" />
<action name="dispCouponAdminInsertCoupon" type="view" standalone="true" />
<action name="dispCouponAdminDeleteCoupon" type="view" standalone="true" />
<action name="dispCouponAdminSkinInfo" type="view" standalone="true" />
<action name="dispCouponAdminFindMember" type="view" standalone="true" />
<action name="dispCouponAdminSampleCode" type="view" standalone="true" />
<action name="coupon" type="view" standalone="true" index="true" />
<action name="dispCouponBox" type="view" standalone="true" />
<action name="procCoupon" type="controller" standalone="true" />
<action name="procCouponAdminInsertConfig" type="controller" standalone="true" />
<action name="procCouponAdminInsertCoupon" type="controller" standalone="true" />
<action name="procCouponAdminDeleteChecked" type="controller" standalone="true" />
<action name="procCouponAdminDeleteCoupon" type="controller" standalone="true" />
<action name="procCouponAdminGenerateCode" type="controller" standalone="true" />
</actions>
</module>