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



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, 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



101
102
103
# File 'lib/redmine/access_control.rb', line 101

def actions
  @actions
end

#nameObject (readonly)

Returns the value of attribute name



101
102
103
# File 'lib/redmine/access_control.rb', line 101

def name
  @name
end

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

Returns:

  • (Boolean)


120
121
122
# File 'lib/redmine/access_control.rb', line 120

def public?
  @public
end

#read?Boolean

Returns:

  • (Boolean)


132
133
134
# File 'lib/redmine/access_control.rb', line 132

def read?
  @read
end

#require_loggedin?Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/redmine/access_control.rb', line 128

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

#require_member?Boolean

Returns:

  • (Boolean)


124
125
126
# File 'lib/redmine/access_control.rb', line 124

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