Class: RoleObject
- Inherits:
-
Object
- Object
- RoleObject
- Includes:
- DataFactory, Foundry, Navigation, StringFactory
- Defined in:
- lib/kuality-coeus/data_objects/identity/role.rb
Constant Summary collapse
- ROLES =
{ # Add roles here as needed for testing... 'Aggregator' => '110', 'approver' => '103', 'Award Budget Aggregator' => '113', 'Award Budget Approver' => '112', 'Award Budget Modifier' => '102', 'Award Budget Viewer' => '101', 'Award Viewer' => '123', 'Award Modifier' => '126', 'Budget Creator' => '108', 'Create Proposal Log' => '140', 'Departments Awards Viewer' => '121', 'Institutional Proposal Viewer' => '118', 'IRB Administrator' => '128', 'IRB Approver' => '99', 'IRB Reviewer' => '127', 'KC Super User' => '177', 'Maintain IRB Questionnaire' => '161', 'Maintain Proposal Questionnaire' => '162', 'Manager' => '98', 'Narrative Writer' => '109', 'Negotiation Creator' => '1399', 'OSP Administrator' => '131', 'OSPApprover' => '100', 'Proposal Creator' => '111', 'Protocol Aggregator' => '105', 'Protocol Approver' => '149', 'Protocol Creator' => '129', 'Protocol Viewer' => '104', 'System User' => '90', 'Unassigned' => '106', 'Viewer' => '107', 'View Subaward' => '1426', 'View Proposal Log' => '142' }
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#permissions ⇒ Object
Returns the value of attribute permissions.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #add_assignee(opts) ⇒ Object
- #add_permission(id) ⇒ Object
- #create ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(browser, opts = {}) ⇒ RoleObject
constructor
A new instance of RoleObject.
- #view ⇒ Object
Methods included from Navigation
#doc_search, #fill_out, #fill_out_item, #on_document?, #on_page?, #open_document, #window_cleanup
Methods included from Utilities
#get, #make_role, #make_user, #random_percentage, #set, #snake_case
Constructor Details
#initialize(browser, opts = {}) ⇒ RoleObject
Returns a new instance of RoleObject.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 48 def initialize(browser, opts={}) @browser = browser defaults = { description: random_alphanums, type: 'Unit', name: random_alphanums, namespace: 'KC-UNT - Kuali Coeus - Department', assignees: collection('RoleAssignees'), permissions: [], responsibilities: [], # TODO: Add this when needed: #delegations: collection('Delegation') } (defaults.merge(opts)) end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 8 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 8 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 8 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 8 def namespace @namespace end |
#permissions ⇒ Object
Returns the value of attribute permissions.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 8 def @permissions end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 8 def type @type end |
Instance Method Details
#add_assignee(opts) ⇒ Object
99 100 101 102 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 99 def add_assignee(opts) view # TODO: Add conditional navigation code here @assignees.add opts end |
#add_permission(id) ⇒ Object
89 90 91 92 93 94 95 96 97 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 89 def (id) view # TODO: Add conditional navigation code here on Role do |page| page..set id page. page.blanket_approve end @permissions << id end |
#create ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 66 def create visit(SystemAdmin).role on(RoleLookup).create on KimTypeLookup do |page| page.type_name.set @type page.search page.return_value @type end on Role do |create| @id=create.id fill_out create, :namespace, :name, :description @permissions.each { |id| create..set id create. } @responsibilities.each { |id| create.add_responsibility_id.set id create.add_responsibility } create.blanket_approve end end |
#exists? ⇒ Boolean
109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 109 def exists? $users.admin.log_in if $users.current_user==nil visit(SystemAdmin).role on RoleLookup do |look| fill_out look, :name, :id look.search if look.results_table.present? # TODO: May need to add code that grabs the id value of the Role. return true else return false end end end |
#view ⇒ Object
104 105 106 107 |
# File 'lib/kuality-coeus/data_objects/identity/role.rb', line 104 def view exists? on(RoleLookup).edit_item @name end |