Class: Cortex::ContentItemPolicy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, content_item) ⇒ ContentItemPolicy

Returns a new instance of ContentItemPolicy.



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

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

Instance Attribute Details

#content_itemObject (readonly)

Returns the value of attribute content_item.



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

def content_item
  @content_item
end

#userObject (readonly)

Returns the value of attribute user.



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

def user
  @user
end

Instance Method Details

#can_publish?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/policies/cortex/content_item_policy.rb', line 39

def can_publish?
  has_permission?("Publish")
end

#create?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/policies/cortex/content_item_policy.rb', line 19

def create?
  has_permission?("Create")
end

#destroy?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/policies/cortex/content_item_policy.rb', line 35

def destroy?
  has_permission?("Destroy")
end

#edit?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/policies/cortex/content_item_policy.rb', line 31

def edit?
  has_permission?("Edit")
end

#index?Boolean

Returns:

  • (Boolean)


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

def index?
  has_permission?("Index")
end

#new?Boolean

Returns:

  • (Boolean)


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

def new?
  has_permission?("New")
end

#show?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/policies/cortex/content_item_policy.rb', line 15

def show?
  has_permission?("Show")
end

#update?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/policies/cortex/content_item_policy.rb', line 27

def update?
  has_permission?("Update")
end