-
Notifications
You must be signed in to change notification settings - Fork 76
Access restriction
gboyke edited this page Dec 10, 2012
·
4 revisions
You may restrict access for users to certain actions in wiki:
- View page
- View history
- Edit page
- Destroy page
In order to do it you should define corresponding methods in your controller:
class WikiPagesController < ApplicationController
acts_as_wiki_pages_controller
def show_allowed? true # Show page to all users end
def history_allowed? true # Show history to all users end
def edit_allowed? current_user ? true : false # Allow editing only to logged users end
def destroy_allowed? @page.path != '' && current_user && current_user.admin? # Allow editing only to admins, and not to root page end
def not_allowed redirect_to login_path # Redirect to login_url when user tries something what not allowed end
end