Class: Redmine::AccessControl::Permission

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine/access_control.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Permission) initialize(name, hash, options)

Returns a new instance of Permission



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/redmine/access_control.rb', line 91

def initialize(name, hash, options)
  @name = name
  @actions = []
  @public = options[:public] || false
  @require = options[:require]
  @project_module = options[:project_module]
  hash.each do |controller, actions|
    if actions.is_a? Array
      @actions << actions.collect {|action| "#{controller}/#{action}"}
    else
      @actions << "#{controller}/#{actions}"
    end
  end
  @actions.flatten!
end

Instance Attribute Details

- (Object) actions (readonly)

Returns the value of attribute actions



89
90
91
# File 'lib/redmine/access_control.rb', line 89

def actions
  @actions
end

- (Object) name (readonly)

Returns the value of attribute name



89
90
91
# File 'lib/redmine/access_control.rb', line 89

def name
  @name
end

- (Object) project_module (readonly)

Returns the value of attribute project_module



89
90
91
# File 'lib/redmine/access_control.rb', line 89

def project_module
  @project_module
end

Instance Method Details

- (Boolean) public?

Returns:

  • (Boolean)


107
108
109
# File 'lib/redmine/access_control.rb', line 107

def public?
  @public
end

- (Boolean) require_loggedin?

Returns:

  • (Boolean)


115
116
117
# File 'lib/redmine/access_control.rb', line 115

def require_loggedin?
  @require && (@require == :member || @require == :loggedin)
end

- (Boolean) require_member?

Returns:

  • (Boolean)


111
112
113
# File 'lib/redmine/access_control.rb', line 111

def require_member?
  @require && @require == :member
end