Class: GlobalRole

Inherits:
Role
  • Object
show all
Defined in:
app/models/global_role.rb

Overview

– copyright OpenProject is a project management system.

Copyright © 2010-2013 the OpenProject Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3.

See doc/COPYRIGHT.rdoc for more details. ++

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ GlobalRole

Returns a new instance of GlobalRole.



16
17
18
19
# File 'app/models/global_role.rb', line 16

def initialize(*args)
  super
  self.assignable = false
end

Class Method Details

.setable_permissionsObject



30
31
32
# File 'app/models/global_role.rb', line 30

def self.setable_permissions
  Redmine::AccessControl.global_permissions
end

Instance Method Details

#assignable=(value) ⇒ Object

Raises:

  • (ArgumentError)


38
39
40
41
# File 'app/models/global_role.rb', line 38

def assignable=(value)
  raise ArgumentError if value == true
  super
end

#assignable_to?(user) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/models/global_role.rb', line 43

def assignable_to?(user)
  true
end

#permissions=(perms) ⇒ Object



21
22
23
24
# File 'app/models/global_role.rb', line 21

def permissions=(perms)
  perms = perms.collect {|p| p.to_sym unless p.blank? }.compact.uniq if perms
  write_attribute(:permissions, perms)
end

#setable_permissionsObject



26
27
28
# File 'app/models/global_role.rb', line 26

def setable_permissions
  Redmine::AccessControl.global_permissions
end

#to_sObject



34
35
36
# File 'app/models/global_role.rb', line 34

def to_s
  name
end