Class: AbstractResourcePolicy

Inherits:
Object
  • Object
show all
Defined in:
app/policies/abstract_resource_policy.rb

Defined Under Namespace

Classes: Scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_user, model) ⇒ AbstractResourcePolicy

Returns a new instance of AbstractResourcePolicy.



18
19
20
21
# File 'app/policies/abstract_resource_policy.rb', line 18

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

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user.



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

def current_user
  @current_user
end

#modelObject (readonly)

Returns the value of attribute model.



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

def model
  @model
end

Instance Method Details

#activate?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'app/policies/abstract_resource_policy.rb', line 79

def activate?
  true
end

#attach?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'app/policies/abstract_resource_policy.rb', line 63

def attach?
  true
end

#create?Boolean

Returns:

  • (Boolean)


43
44
45
46
# File 'app/policies/abstract_resource_policy.rb', line 43

def create?
  # @current_user.admin?
  true
end

#deactivate?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'app/policies/abstract_resource_policy.rb', line 83

def deactivate?
  true
end

#defer?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'app/policies/abstract_resource_policy.rb', line 75

def defer?
  true
end

#delete?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'app/policies/abstract_resource_policy.rb', line 59

def delete?
  true
end

#destroy?Boolean

Returns:

  • (Boolean)


53
54
55
56
57
# File 'app/policies/abstract_resource_policy.rb', line 53

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

#detach?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'app/policies/abstract_resource_policy.rb', line 67

def detach?
  true
end

#edit?Boolean

Returns:

  • (Boolean)


33
34
35
36
# File 'app/policies/abstract_resource_policy.rb', line 33

def edit?
  # @current_user.admin?
  true
end

#index?Boolean

Returns:

  • (Boolean)


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

def index?
  # @current_user.admin?
  true
end

#new?Boolean

Returns:

  • (Boolean)


28
29
30
31
# File 'app/policies/abstract_resource_policy.rb', line 28

def new?
  # @current_user.admin?
  true
end

#prefer?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'app/policies/abstract_resource_policy.rb', line 71

def prefer?
  true
end

#show?Boolean

Returns:

  • (Boolean)


38
39
40
41
# File 'app/policies/abstract_resource_policy.rb', line 38

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

#update?Boolean

Returns:

  • (Boolean)


48
49
50
51
# File 'app/policies/abstract_resource_policy.rb', line 48

def update?
  # @current_user.admin?
  true
end