Class: Goldberg::ControllerAction
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Model
included
#associated_valid?, #no_errors_in_associated?, #save_associated, #save_associated!, #save_with_unsaved_flag, #to_label, #unsaved=, #unsaved?
Instance Attribute Details
Returns the value of attribute allowed.
11
12
13
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/controller_action.rb', line 11
def allowed
@allowed
end
|
#specific_name ⇒ Object
Returns the value of attribute specific_name.
11
12
13
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/controller_action.rb', line 11
def specific_name
@specific_name
end
|
Class Method Details
.actions_allowed(permission_ids) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/controller_action.rb', line 46
def self.actions_allowed(permission_ids)
if permission_ids
perms = {}
for id in permission_ids do
perms[id] = true
end
end
actions = ControllerAction.find(:all)
for action in actions do
if action.permission_id
if perms.has_key?(action.permission_id)
action.allowed = 1
else
action.allowed = 0
end
else if perms.has_key?(action.site_controller.permission_id)
action.allowed = 1
else
action.allowed = 0
end
end
end
return actions
end
|
.find_for_permission(p_ids) ⇒ Object
75
76
77
78
79
80
81
82
83
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/controller_action.rb', line 75
def self.find_for_permission(p_ids)
if p_ids and p_ids.length > 0
return find(:all,
:conditions => ['permission_id in (?)', p_ids],
:order => 'name')
else
return Array.new
end
end
|
Instance Method Details
#before_destroy ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/controller_action.rb', line 37
def before_destroy
if self..length > 0
self.errors.add(:id, "Cannot delete an Action that is in the menu!")
return false
else
return true
end
end
|
#effective_permission ⇒ Object
13
14
15
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/controller_action.rb', line 13
def effective_permission
self.permission || self.site_controller.permission
end
|
17
18
19
20
21
22
23
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/controller_action.rb', line 17
def fullname
if self.site_controller_id and self.site_controller_id > 0
return "#{self.site_controller.name}: #{self.name}"
else
return "#{self.name}"
end
end
|
29
30
31
32
33
34
35
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/controller_action.rb', line 29
def
if self.id
MenuItem.find_all_by_controller_action_id(self.id, :order => 'label')
else
[]
end
end
|
25
26
27
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/controller_action.rb', line 25
def url
@url ||= "/#{self.site_controller.name}/#{self.name}"
end
|