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

#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, options)
  @name = name
  @actions = []
  @public = options[:public] || false
  @require = options[:require]
  @read = options[:read] || false
  @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

#actionsObject (readonly)

Returns the value of attribute actions.



103
104
105
# File 'lib/redmine/access_control.rb', line 103

def actions
  @actions
end

#nameObject (readonly)

Returns the value of attribute name.



103
104
105
# File 'lib/redmine/access_control.rb', line 103

def name
  @name
end

#project_moduleObject (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

Returns:

  • (Boolean)


122
123
124
# File 'lib/redmine/access_control.rb', line 122

def public?
  @public
end

#read?Boolean

Returns:

  • (Boolean)


134
135
136
# File 'lib/redmine/access_control.rb', line 134

def read?
  @read
end

#require_loggedin?Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/redmine/access_control.rb', line 130

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

#require_member?Boolean

Returns:

  • (Boolean)


126
127
128
# File 'lib/redmine/access_control.rb', line 126

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