Class: UserPolicy

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/user_policy.rb

Overview

Authorizes access to User objects

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#initialize, #scope, #user

Constructor Details

This class inherits a constructor from ApplicationPolicy

Instance Method Details

#create?false Also known as: new?

Returns users only are created via invitation

Returns:

  • (false)

    users only are created via invitation



16
17
18
# File 'app/policies/user_policy.rb', line 16

def create?
  false
end

#destroy?Boolean

Returns whether or not the user is a staff member

Returns:

  • (Boolean)

    whether or not the user is a staff member



30
31
32
# File 'app/policies/user_policy.rb', line 30

def destroy?
  organization_user.staff?
end

#edit?Boolean Also known as: update?

Returns whether or not the user is editing his/her own user record

Returns:

  • (Boolean)

    whether or not the user is editing his/her own user record



23
24
25
# File 'app/policies/user_policy.rb', line 23

def edit?
  self? || organization_user.staff?
end

#index?false

Note:

will change when we build a separate admin UI

Returns we don't allow all users to be enumerated

Returns:

  • (false)

    we don't allow all users to be enumerated



6
7
8
# File 'app/policies/user_policy.rb', line 6

def index?
  false
end

#show?true

Returns anyone can view any user's profile

Returns:

  • (true)

    anyone can view any user's profile



11
12
13
# File 'app/policies/user_policy.rb', line 11

def show?
  true
end