Sha256: ded6441fa120fae1a1be37016a1fad31216bbb2df6443c06d842149368a1166b

Contents?: true

Size: 323 Bytes

Versions: 6

Compression:

Stored size: 323 Bytes

Contents

class ApiAbility
  include CanCan::Ability
  def initialize(user)
    return unless user
    alias_action :view, :create, :update, :delete, to: :crud

    can :update_profile, user
    can :view, Models::User
    can :update, Models::User, { id: user.id }

    if user.role == :admin
      can :crud, :all
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
grape-gen-0.0.6 template/abilities/api_ability.rb
grape-gen-0.0.5 template/abilities/api_ability.rb
grape-gen-0.0.4 template/abilities/api_ability.rb
grape-gen-0.0.3 template/abilities/api_ability.rb
grape-gen-0.0.2 template/abilities/api_ability.rb
grape-gen-0.0.1 template/abilities/api_ability.rb