Class: Ability::LayerResourceType
Overview
Instance Method Summary
collapse
#add_ability, for_class, #has_resource_list?, #role_can?, #roles_can?, #roles_permissions
Constructor Details
Returns a new instance of LayerResourceType.
84
85
86
|
# File 'app/models/ability.rb', line 84
def initialize
super(Layer, 'Layer')
end
|
Instance Method Details
#actions ⇒ Object
88
89
90
91
92
93
94
95
|
# File 'app/models/ability.rb', line 88
def actions
[
:show, :edit, :legend, :query ]
end
|
#compare(resource_object, resource_name) ⇒ Object
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'app/models/ability.rb', line 101
def compare(resource_object, resource_name)
topic, layer = resource_name.split('/')
if topic == '*'
if layer == '*'
true
else
resource_object.name == layer
end
else
if layer == '*'
layer_topics_lookup[resource_object.id].include?(topic)
else
resource_object.name == layer && layer_topics_lookup[resource_object.id].include?(topic)
end
end
end
|
#resources ⇒ Object
97
98
99
|
# File 'app/models/ability.rb', line 97
def resources
Layer.select("id,name")
end
|