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

Access in actions


Go to End


2 Posts   1042 Views

Avatar
cachobong

Community Member, 9 Posts

3 May 2013 at 7:51pm

Is there any way that i can check which action was accessed? for example for Register action on a Sign Up Page, i can access this without having to login then if i just access the page without any action i am required to login.

Example:
mysite.com/upgrade-me <-- has to be logged in
mysite.com/upgrade-me/Register <-- no need to be logged in.

Avatar
Willr

Forum Moderator, 5523 Posts

5 May 2013 at 4:28pm

You can require permissions in the $url_handlers helper or in your actions method.

function youraction() {
if (!Member::currentUser()) {
return Security::permissionFailure();
}

// rest of youraction ..

}