Class: ODDB::View::Admin::YusPrivileges

Inherits:
HtmlGrid::List show all
Defined in:
src/view/admin/entity.rb

Constant Summary

COMPONENTS =
{
  [0,0] =>  :checkbox,
}
LEGACY_INTERFACE =
false
LABEL =
true
OMIT_HEADER =
true
SORT_DEFAULT =
nil

Constants inherited from HtmlGrid::List

BACKGROUND_SUFFIX

Instance Method Summary (collapse)

Instance Method Details

- (Object) checkbox(model)



28
29
30
31
32
33
34
35
36
37
38
# File 'src/view/admin/entity.rb', line 28

def checkbox(model)
  box = HtmlGrid::InputCheckbox.new("yus_privileges[#{model}]", model, 
                                    @session, self)
  priv = model.split('|')
  if(@entity.privileged?(*priv))
    box.set_attribute('checked', true)
  elsif(@entity.allowed?(*priv))
    box.set_attribute('disabled', true)
  end
  [box, model.sub('|', ' ')] #@lookandfeel.lookup(model)]
end

- (Object) init



20
21
22
23
24
25
26
27
# File 'src/view/admin/entity.rb', line 20

def init
  @entity = @model
  @model = @session.valid_values(:yus_privileges).select { |privilege|
    action, key = privilege.split('|')
    @session.allowed?('grant', action)
  }
  super
end

- (Object) row_css(model, bg_flag = false)



39
40
41
42
# File 'src/view/admin/entity.rb', line 39

def row_css(model, bg_flag=false)
  priv = model.split('|')
  'disabled' if(!@entity.privileged?(*priv) && @entity.allowed?(*priv))
end