-
Notifications
You must be signed in to change notification settings - Fork 0
Simple authorization
License
toretore/simple_authorization
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
SimpleAuthorization =================== * Install * Unless "roles" table already exists or do not want: * script/generate simple_authorization --migration Role * rake db:migrate * User.has_many(:roles) * Include SimpleAuthorization::ModelMethods::User in User Example ======= #No roles: class AdminController < ApplicationController private #Authorize is where authorization happens. Override to define #what that means for a particular controller. The default implementation #is to check whether current_user has the roles required by the #controller/action, and nothing will happen if no roles are required def authorize redirect_to login_url unless current_user.admin? end end #Using the built-in role system class ArticlesController < ApplicationController require_roles :admin, :only => [:destroy] require_roles :editor, :only => [:new, :edit, :create, :update] end Copyright (c) 2009 Tore Darell, released under the MIT license
About
Simple authorization
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published