Sha256: de0e97254ce68b0d8e42f7eb3aebd35c5f049a42cecea5556451e5282759028a

Contents?: true

Size: 405 Bytes

Versions: 22

Compression:

Stored size: 405 Bytes

Contents

class UserPolicy
  attr_reader :current_user, :model

  def initialize(current_user, model)
    @current_user = current_user
    @user = model
  end

  def index?
    @current_user.admin?
  end

  def show?
    @current_user.admin? or @current_user == @user
  end

  def update?
    @current_user.admin?
  end

  def destroy?
    return false if @current_user == @user
    @current_user.admin?
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rails_apps_pages-0.6.7 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.6.6 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.6.5 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.6.4 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.6.3 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.6.2 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.6.0 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.16 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.15 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.14 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.13 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.12 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.11 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.10 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.9 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.8 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.7 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.6 lib/generators/pages/authorized/templates/devise/user_policy.rb
rails_apps_pages-0.5.5 lib/generators/pages/authorized/templates/user_policy.rb
rails_apps_pages-0.5.4 lib/generators/pages/authorized/templates/user_policy.rb