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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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   1426 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....