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
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/redmine/access_control.rb', line 103 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
101 102 103 |
# File 'lib/redmine/access_control.rb', line 101 def actions @actions end |
#name ⇒ Object (readonly)
Returns the value of attribute name
101 102 103 |
# File 'lib/redmine/access_control.rb', line 101 def name @name end |
#project_module ⇒ Object (readonly)
Returns the value of attribute project_module
101 102 103 |
# File 'lib/redmine/access_control.rb', line 101 def project_module @project_module end |
Instance Method Details
#public? ⇒ Boolean
120 121 122 |
# File 'lib/redmine/access_control.rb', line 120 def public? @public end |
#read? ⇒ Boolean
132 133 134 |
# File 'lib/redmine/access_control.rb', line 132 def read? @read end |
#require_loggedin? ⇒ Boolean
128 129 130 |
# File 'lib/redmine/access_control.rb', line 128 def require_loggedin? @require && (@require == :member || @require == :loggedin) end |
#require_member? ⇒ Boolean
124 125 126 |
# File 'lib/redmine/access_control.rb', line 124 def require_member? @require && @require == :member end |