Class: Redmine::AccessControl::Permission
- Inherits:
-
Object
- Object
- Redmine::AccessControl::Permission
- Defined in:
- lib/redmine/access_control.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#project_module ⇒ Object
readonly
Returns the value of attribute project_module.
Instance Method Summary collapse
-
#initialize(name, hash, options) ⇒ Permission
constructor
A new instance of Permission.
- #public? ⇒ Boolean
- #read? ⇒ Boolean
- #require_loggedin? ⇒ Boolean
- #require_member? ⇒ Boolean
Constructor Details
#initialize(name, hash, options) ⇒ Permission
Returns a new instance of Permission.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/redmine/access_control.rb', line 105 def initialize(name, hash, ) @name = name @actions = [] @public = [:public] || false @require = [:require] @read = [:read] || false @project_module = [: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
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
103 104 105 |
# File 'lib/redmine/access_control.rb', line 103 def actions @actions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
103 104 105 |
# File 'lib/redmine/access_control.rb', line 103 def name @name end |
#project_module ⇒ Object (readonly)
Returns the value of attribute project_module.
103 104 105 |
# File 'lib/redmine/access_control.rb', line 103 def project_module @project_module end |
Instance Method Details
#public? ⇒ Boolean
122 123 124 |
# File 'lib/redmine/access_control.rb', line 122 def public? @public end |
#read? ⇒ Boolean
134 135 136 |
# File 'lib/redmine/access_control.rb', line 134 def read? @read end |
#require_loggedin? ⇒ Boolean
130 131 132 |
# File 'lib/redmine/access_control.rb', line 130 def require_loggedin? @require && (@require == :member || @require == :loggedin) end |
#require_member? ⇒ Boolean
126 127 128 |
# File 'lib/redmine/access_control.rb', line 126 def require_member? @require && @require == :member end |