Class: Goldberg::Role
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?
Class Method Details
.rebuild_cache ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/role.rb', line 16
def Role.rebuild_cache
roles = Role.find(:all)
for role in roles do
role.cache = nil ; role.save
role.cache = Hash.new
role.rebuild_credentials
role.
role.save
end
end
|
Instance Method Details
#get_parents ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/role.rb', line 39
def get_parents
parents = Array.new
seen = Hash.new
current = self.id
while current
role = Role.find(current)
if role
if not seen.has_key?(role.id)
parents << role
seen[role.id] = true
current = role.parent_id
else
current = nil
end
else
current = nil
end
end
return parents
end
|
#get_start_path ⇒ Object
63
64
65
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/role.rb', line 63
def get_start_path
self.start_path || Goldberg.settings.get_start_path
end
|
#rebuild_credentials ⇒ Object
30
31
32
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/role.rb', line 30
def rebuild_credentials
self.cache[:credentials] = Credentials.new(self.id)
end
|
34
35
36
37
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/models/goldberg/role.rb', line 34
def
= .new(self)
self.cache[:menu] =
end
|