Class: Cortex::ContentTypePolicy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, content_type) ⇒ ContentTypePolicy

Returns a new instance of ContentTypePolicy.



5
6
7
8
# File 'app/policies/cortex/content_type_policy.rb', line 5

def initialize(user, content_type)
  @user = user
  @content_type = content_type
end

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type.



3
4
5
# File 'app/policies/cortex/content_type_policy.rb', line 3

def content_type
  @content_type
end

#userObject (readonly)

Returns the value of attribute user.



3
4
5
# File 'app/policies/cortex/content_type_policy.rb', line 3

def user
  @user
end

Instance Method Details

#create?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/policies/cortex/content_type_policy.rb', line 18

def create?
  @user.is_superadmin?
end

#destroy?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/policies/cortex/content_type_policy.rb', line 34

def destroy?
  @user.is_superadmin?
end

#edit?Boolean

Returns:

  • (Boolean)


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

def edit?
  update?
end

#index?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/policies/cortex/content_type_policy.rb', line 10

def index?
  @user.is_superadmin?
end

#new?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/policies/cortex/content_type_policy.rb', line 22

def new?
  create?
end

#show?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/policies/cortex/content_type_policy.rb', line 14

def show?
  @user.is_superadmin?
end

#update?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/policies/cortex/content_type_policy.rb', line 26

def update?
  @user.is_superadmin?
end