Class: OffTheGrid::User

Inherits:
NamedResource show all
Defined in:
lib/off_the_grid/user.rb

Overview

A class to represent SGE Users

Instance Attribute Summary collapse

Attributes inherited from NamedResource

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NamedResource

#initialize

Methods included from GridResource

#<=>, #delete, #extract_detail, #new?, #save, #validate_before_delete

Constructor Details

This class inherits a constructor from OffTheGrid::NamedResource

Instance Attribute Details

#default_projectObject

Returns the value of attribute default_project.



30
31
32
# File 'lib/off_the_grid/user.rb', line 30

def default_project
  @default_project
end

Class Method Details

.adminsObject

Get the list of admin users



10
11
12
# File 'lib/off_the_grid/user.rb', line 10

def self.admins
  `qconf -sm`.chomp.split("\n").sort.collect { |name| new(name) }
end

.listObject

Get the list of all SGE users



5
6
7
# File 'lib/off_the_grid/user.rb', line 5

def self.list
  `qconf -suserl`.chomp.split("\n").sort.collect { |name| new(name) }
end

.managersObject

An alias for admins



15
16
17
# File 'lib/off_the_grid/user.rb', line 15

def self.managers
  admins
end

.operatorsObject

Get the list of operator users



20
21
22
# File 'lib/off_the_grid/user.rb', line 20

def self.operators
  `qconf -so`.chomp.split("\n").sort.collect { |name| new(name) }
end

Instance Method Details

#admin?Boolean Also known as: manager?

Returns:

  • (Boolean)


32
33
34
# File 'lib/off_the_grid/user.rb', line 32

def admin?
  admins.include?(self)
end

#detailsObject



24
25
26
# File 'lib/off_the_grid/user.rb', line 24

def details
  `qconf -suser #{name}`.chomp
end

#operator?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
# File 'lib/off_the_grid/user.rb', line 38

def operator?
  # TODO: learn more about the difference between "operator" and "manager"
  #  Maybe admins are always operators?
  operators.include?(self)
end