Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » ViewerGroups - Changing CanViewType on page.

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

Page: 1
Go to End
Author Topic: 787 Views
  • neros3
    Avatar
    Community Member
    51 Posts

    ViewerGroups - Changing CanViewType on page. Link to this post

    Hi

    I'm trying to change the CanViewType on a page and add one or more groups to the ViewerGroups().
    Adding the groups with the add-function works fine, but changing the CanViewType doesn't work for me.

    This brings me to another thing that I find myself spending time on; write() or writeToStage() and then publish.
    I think that writeToStage is only for pages (classes that extends page).
    When a class extends DataObject then write() should be good enough... is this correct?

    So for the CanViewType I have tried both write() on the page and writeToStage("Stage") and then publish("Stage", "Live") on the page.
    Some times I have both a row in the Sitetree and the Sitetree_Live table. Sometimes I manage to get the "OnlyTheseUsers" into the CanViewType, but then its only for the Live table, which is good, but I have the feeling that the CMS uses the non-live table so I would like to keep those in sync.

    This is of course used for viewing rights on my site. If a user has no access he/she will be redirected to login page. Is this the desired way to do this? I have also tried using allowed_actions and putting a boolean function to each action. But then I cant control behavior like redirect to login and redirect back on successful login.

    Thank you!

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