Sha256: 587ac27046f0297c136b7fcde30c47be80ee95b9d654ac049e593dde22f2ffb8

Contents?: true

Size: 1.68 KB

Versions: 3

Compression:

Stored size: 1.68 KB

Contents

authorization do
  role :guest do
    has_permission_on :users, :to => [:create, :update]
    has_permission_on :accounts, :to => [:show, :create]
    has_permission_on :comments, :to => [:read, :create]
  end
  
  role :default do
    has_permission_on :accounts, :to => [:show]
    has_permission_on :accounts, :to => [:update] do
      if_attribute :id => is {user.id}
    end
    
    has_permission_on :users, :to => [:update] do
      if_attribute :id => is {user.id}
    end
        
    has_permission_on :comments, :to => [:read, :create]
    has_permission_on :comments, :to => [:update, :delete] do
      if_attribute :author => is {user}
    end
  end
  
  role :admin do
    # Models
    has_permission_on :users, :to => :manage
    has_permission_on :comments, :to => :manage
    has_permission_on :accounts, :to => :manage
    
    # Administration module
    has_permission_on :manage_structures, :to => :manage
    has_permission_on :manage_users, :to => [:manage, :activate]
    has_permission_on :manage_pages, :to => :manage
    has_permission_on :manage_pictures, :to => :manage
    has_permission_on :manage_assets, :to => :manage
    has_permission_on :manage_posts, :to => :manage    
    has_permission_on :manage_settings, :to => :manage
    
    has_permission_on :authorization_rules, :to => :read
    has_permission_on :authorization_usages, :to => :read
  end
end

privileges do
  # default privilege hierarchies to facilitate RESTful Rails apps
  privilege :manage, :includes => [:create, :read, :update, :delete]
  privilege :read,   :includes => [:index, :show]
  privilege :create, :includes => :new
  privilege :update, :includes => :edit
  privilege :delete, :includes => :destroy
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
freeberry-0.2.7 lib/generators/freeberry/base/templates/config/authorization_rules.rb
freeberry-0.2.6 lib/generators/freeberry/base/templates/config/authorization_rules.rb
freeberry-0.2.5 lib/generators/freeberry/base/templates/config/authorization_rules.rb