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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Model Admin Permission


Reply

7 Posts   1870 Views

Avatar
ttyl

28 May 2010 at 7:24am Community Member, 114 Posts

I saw there was another thread of this but it didn't answer my question. I want to give a user access to a model admin and nothing else. I can make it happen so they log in and see the model admin page but they can only search, not add. when I check "Full administrative rights" they can see everything and add objects. however, if I uncheck "Full administrative rights" but still check every single other box they can search but not add - so something strange is going on. anybody know how to fix this?

Avatar
swaiba

28 May 2010 at 8:46pm (Last edited: 28 May 2010 8:47pm), Forum Moderator, 1796 Posts

override the following functions like this for each dataobject that is being managed...

   function canCreate() {return true;}
   function canEdit() {return true;}
   function canDelete() {return true;}

Barry

Avatar
ttyl

3 June 2010 at 4:03am Community Member, 114 Posts

Thanks Barry, that works.

Avatar
steve_nyhof

24 June 2010 at 8:17am Community Member, 224 Posts

where do I find the file to add these entries?

Avatar
ttyl

24 June 2010 at 8:20am Community Member, 114 Posts

add to your dataobject class.

ie

class MyDataObject extends DataObject {
.....
   function canCreate() {return true;}

}

?>

Avatar
steve_nyhof

24 June 2010 at 9:21am Community Member, 224 Posts

Thank you, and what file would that be in?

Avatar
TotalNet

24 June 2010 at 9:52am Community Member, 181 Posts

It's in the file containing the dataobject class you want to apply the permission to.

see [url=http://www.silverstripe.org/data-model-questions/show/257007?showPost=287076#post287076]my reply to your other question[/url] for a more comprehensive answer

Rich