ottogal Posted September 23, 2019 Share Posted September 23, 2019 Hi all, for testing pusposes I created one single page using an own template. Now I want to create a user with a special role which gives view access just for that single page, not to all the other pages with different templates. The problem is that a new role always inherits the permissions of the guest role, hence view access to all pages. To deny the view permission for the guest role for all the other templates (but not the homepage) is not a way because guest users should view the site normally. Is there a simple solution for this case? I wouldn't like to install some complex module for this... Thank you for ideas! Link to comment Share on other sites More sharing options...
elabx Posted September 23, 2019 Share Posted September 23, 2019 A hook on Page::viewable? Link to comment Share on other sites More sharing options...
Robin S Posted September 23, 2019 Share Posted September 23, 2019 12 hours ago, ottogal said: To deny the view permission for the guest role for all the other templates (but not the homepage) is not a way because guest users should view the site normally. This doesn't make much sense to me because the guest role should always be the most restricted role in the site. Making a role more restricted than the guest role isn't effective because the user could just log out and then access the protected content. Link to comment Share on other sites More sharing options...
monchu Posted September 24, 2019 Share Posted September 24, 2019 Why not use $user->isLoggedin() for the new role in your template 1 Link to comment Share on other sites More sharing options...
bernhard Posted September 24, 2019 Share Posted September 24, 2019 Could you please explain by example what you are trying to achieve? At the moment I understood you like this: Public users should be allowed to view all public pages, but not page XY User foo should be allowed to view ONLY page XY (template bar) but not all public pages 12 hours ago, Robin S said: This doesn't make much sense to me because the guest role should always be the most restricted role in the site. Same here. Or I didn't understand you ? 1 Link to comment Share on other sites More sharing options...
ottogal Posted September 24, 2019 Author Share Posted September 24, 2019 3 hours ago, bernhard said: Public users should be allowed to view all public pages, but not page XY User foo should be allowed to view ONLY page XY (template bar) but not all public pages Indeed, that was my aim originally - I didn't want infect you with my confusion... In the meantime I decided to accept that user foo would have view (not edit) permission to all the public pages. Important is that no guest user has access to the special page XY. Many thanks for the help. 2 Link to comment Share on other sites More sharing options...
ottogal Posted September 26, 2019 Author Share Posted September 26, 2019 To report back: The modules Page Protector and Protected Mode solve all my riddles. Thanks to @adrian for these fine tools! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now