Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » ModelAdmin 'Create' permissions

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

Page: 1
Go to End
Author Topic: 1799 Views
  • JoshuaLewis
    Avatar
    Community Member
    76 Posts

    ModelAdmin 'Create' permissions Link to this post

    I'm using a ModelAdmin subclass to manage a list of front-end users which are extended from Member. Everything is functioning just fine except that only members of the main administrator group can create and edit these new members and I want my Editor user group to have these privileges as well.

    I've added the relevant permissions to the editor group through the Security.Permissions tab and even tried adding canCreate and canEdit to my Member and ModelAdmin sub-classes but nothing seems to work.

    Does anyone know how I go about granting my Editor group the permissions needed to create and edit these Members through ModelAdmin?

    I'm using SS v.2.3.7 with the 2.3 branch of DataObjectManager and SWFUploadField as well as the stable release of Multi-Step Form.

  • mirkosassetti
    Avatar
    Community Member
    20 Posts

    Re: ModelAdmin 'Create' permissions Link to this post

    Same problem here ... i'm investigating but nothing found yet.

  • mirkosassetti
    Avatar
    Community Member
    20 Posts

    Re: ModelAdmin 'Create' permissions Link to this post

    Probably my problem isn't really the same.
    My problem was with standard extended classes of DataObject used with ModelAdmin. With only access permission in the member group the user could only view ModelAdmin interface, but not add or edit items.
    Next i try to add this code on my managed DataObject classes

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

    and now users of groups other than Administrator can add and edit items (if i set access permissions in in security tab).

  • JoshuaLewis
    Avatar
    Community Member
    76 Posts

    Re: ModelAdmin 'Create' permissions Link to this post

    Thanks mirkosassetti, that works on my setup as well. It looks like all four functions are needed and not just canCreate() and canEdit()

  • Corry
    Avatar
    Community Member
    17 Posts

    Re: ModelAdmin 'Create' permissions Link to this post

    Thanks for posting that code, mirkosassetti. It solved my issue too.

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