Class: OffTheGrid::User
- Inherits:
-
NamedResource
- Object
- NamedResource
- OffTheGrid::User
- Defined in:
- lib/off_the_grid/user.rb
Overview
A class to represent SGE Users
Instance Attribute Summary collapse
-
#default_project ⇒ Object
Returns the value of attribute default_project.
Attributes inherited from NamedResource
Class Method Summary collapse
-
.admins ⇒ Object
Get the list of admin users.
-
.list ⇒ Object
Get the list of all SGE users.
-
.managers ⇒ Object
An alias for admins.
-
.operators ⇒ Object
Get the list of operator users.
Instance Method Summary collapse
- #admin? ⇒ Boolean (also: #manager?)
- #details ⇒ Object
- #operator? ⇒ Boolean
Methods inherited from NamedResource
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_project ⇒ Object
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
.admins ⇒ Object
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 |
.list ⇒ Object
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 |
.managers ⇒ Object
An alias for admins
15 16 17 |
# File 'lib/off_the_grid/user.rb', line 15 def self.managers admins end |
.operators ⇒ Object
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?
32 33 34 |
# File 'lib/off_the_grid/user.rb', line 32 def admin? admins.include?(self) end |
#details ⇒ Object
24 25 26 |
# File 'lib/off_the_grid/user.rb', line 24 def details `qconf -suser #{name}`.chomp end |
#operator? ⇒ 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 |