Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Can't set canEdit and canCreate in a Decorator

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 942 Views
  • Martijn
    Avatar
    Community Member
    271 Posts

    Can't set canEdit and canCreate in a Decorator Link to this post

    Ok, I feel quite stupid now, cause this must be very simple:

    This returns true:
    Object::has_extension('ErrorPage',"ErrorPageDecorator");

    But the canCreate() and canEdit() in the Decorator does not change anything in the CMS...

    <?php
    // _config.php : Object::add_extension('ErrorPage','ErrorPageDecorator');
    class ErrorPageDecorator extends DataObjectDecorator{
       
       function __construct() {
          parent::__construct();
       }
       
       function canCreate(&$member) {
          //return Permission::check("ADMIN");
          return false;
       }
       
       function canEdit(&$member){
          return false;   
       }
    }

    What am i missing?

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Can't set canEdit and canCreate in a Decorator Link to this post

    OK,

    Seems this does work when not logged in as admin....

    942 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.