0
안녕하십니까,Silverstripe 3 - CMS에서 컨트롤러 액세스 보안을 구현할 수 없습니다.
저는 아직 silverstripe에 익숙하지 않고 몇 가지 간단한 작업을 알아 내려고하고 있습니다.
현재 데이터 개체 내에서 생성되어 CMS를 통해 구성된 내 페이지 컨트롤러 기능에서 보안 제한을 구현하려고합니다.
그러나 사용자에게 개체보기 권한을 부여했는지 여부에 관계없이 사용자는 아무렇게나 보게됩니다.
아래의 예를 참조하십시오
class MyComponent extends DataObject implements PermissionProvider{
///>... this is just a snippet not the full class ...
///>@Override
public function canView($member = null){
return Permission::check('COMPONENT_VIEW');
}//canView
/**
* \brief the rest of the permission functions follow the same format as above
* i.e: canEdit, canDelete, canCreate
*/
///>@Override
function providePermissions(){
return array(
'COMPONENT_VIEW' => 'Can view a component object',
'COMPONENT_EDIT' => 'Can edit a component object',
'COMPONENT_DELETE' => 'Can delete a component object',
'COMPONENT_CREATE' => 'Can create a component object',
);
}//providePermissions
}//class
가 좋아을, 그래서 클래스는 위의 좋은 작품; CMS 관리 섹션에서 사용자에 대한 그룹 내의 사용 권한을 토글 할 수 있습니까? 당신의 도움을
///>Controller class snippet
class My_Controller extends Page_Controller{
public function ListMyComponents(){
$components = MyComponent::get()->filter(array('Status' => 'Enable'));
///>NOTE: How can I check to see if the user has access to view the component???
///> I've even tried, Member::canView(Member::currentUser()); It doesn't work!
return $components;
}//ListMyComponents
}//class
///>ss template file snippet
<% if ListMyComponents %>
<% loop ListMyComponents %>
$Title
<% end_loop %>
<% end_if %>
감사 : 문제가에서 어디
여기에 아래의 코드를 참조합니다.