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

Using RestfulServer with Member DataObjectDecorator


Go to End


1006 Views

Avatar
monkeyben

Community Member, 25 Posts

9 January 2013 at 9:09am

Edited: 09/01/2013 9:10am

I have a site I am building that my client has a need to do things via restful server. All is going fine until I have tried to use the restful server to create a new member.

This line of code https://github.com/silverstripe/silverstripe-restfulserver/blob/master/code/RestfulServer.php#L398

i.e.

if(!singleton($className)->canCreate()) return $this->permissionFailure();

is using the canCreate() function from Member (well, from DataObject) - its is ignoring the canCreate() function in my CustomMember DataObjectDecorator. This means the code is checking to see if the member is admin when it needs no login (thats how my client wants it).

I've tried using customclass() to replace Member with a custom class and that didnt work either.

I dont want to touch the core files unless I have to but I can't find a solution.

Thanks,

Ben :)

P.S. the install is version 2.4 (2.4.7 IIRC).