Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Can't set canEdit and canCreate in a Decorator


Go to End


2 Posts   1545 Views

Avatar
Martijn

Community Member, 271 Posts

28 July 2010 at 9:03am

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?

Avatar
Martijn

Community Member, 271 Posts

28 July 2010 at 10:49pm

OK,

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