Class: AssignmentPermissionsObject
- Inherits:
-
Object
- Object
- AssignmentPermissionsObject
- Includes:
- DataFactory, Foundry, Workflows
- Defined in:
- lib/sambal-cle/data_objects/assignment_permissions.rb
Overview
TODO: Need to add support for Group-specific permissions
Instance Attribute Summary collapse
-
#group ⇒ Object
Returns the value of attribute group.
-
#guest ⇒ Object
Returns the value of attribute guest.
-
#instructor ⇒ Object
Returns the value of attribute instructor.
-
#site ⇒ Object
Returns the value of attribute site.
-
#student ⇒ Object
Returns the value of attribute student.
-
#teaching_assistant ⇒ Object
Returns the value of attribute teaching_assistant.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(browser, opts = {}) ⇒ AssignmentPermissionsObject
constructor
A new instance of AssignmentPermissionsObject.
- #set(opts = {}) ⇒ Object
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ AssignmentPermissionsObject
Returns a new instance of AssignmentPermissionsObject.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sambal-cle/data_objects/assignment_permissions.rb', line 9 def initialize(browser, opts={}) @browser = browser checkboxes={:all_groups=>nil, :new=>nil, :submit=>nil, :delete=>nil, :read=>nil, :revise=>nil, :grade=>nil, :receive_notifications=>nil, :share_drafts=>nil} @guest=checkboxes @instructor=checkboxes @student=checkboxes @teaching_assistant=checkboxes (opts) requires @site get end |
Instance Attribute Details
#group ⇒ Object
Returns the value of attribute group.
7 8 9 |
# File 'lib/sambal-cle/data_objects/assignment_permissions.rb', line 7 def group @group end |
#guest ⇒ Object
Returns the value of attribute guest.
7 8 9 |
# File 'lib/sambal-cle/data_objects/assignment_permissions.rb', line 7 def guest @guest end |
#instructor ⇒ Object
Returns the value of attribute instructor.
7 8 9 |
# File 'lib/sambal-cle/data_objects/assignment_permissions.rb', line 7 def instructor @instructor end |
#site ⇒ Object
Returns the value of attribute site.
7 8 9 |
# File 'lib/sambal-cle/data_objects/assignment_permissions.rb', line 7 def site @site end |
#student ⇒ Object
Returns the value of attribute student.
7 8 9 |
# File 'lib/sambal-cle/data_objects/assignment_permissions.rb', line 7 def student @student end |
#teaching_assistant ⇒ Object
Returns the value of attribute teaching_assistant.
7 8 9 |
# File 'lib/sambal-cle/data_objects/assignment_permissions.rb', line 7 def teaching_assistant @teaching_assistant end |
Instance Method Details
#get ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/sambal-cle/data_objects/assignment_permissions.rb', line 45 def get open_my_site_by_name @site assignments reset on AssignmentsList do |list| list. end on AssignmentsPermissions do |perm| roles={@guest=>"Guest", @instructor=>"Instructor", @student=>"Student", @teaching_assistant=>"Teaching Assistant"} roles.each_pair do |role, name| role.each_key { |key| role.store(key, checkbox_setting(perm.send(key, name))) } end perm.cancel end end |
#set(opts = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sambal-cle/data_objects/assignment_permissions.rb', line 21 def set opts={} open_my_site_by_name @site assignments reset on AssignmentsList do |list| list. end on AssignmentsPermissions do |perm| roles={:guest=>"Guest", :instructor=>"Instructor", :student=>"Student", :teaching_assistant=>"Teaching Assistant"} roles.each_pair do |role, title| if opts[role]!=nil opts[role].each_pair do |checkbox, setting| perm.send(checkbox, title).send(setting) end end end perm.save end @guest = @guest.merge(opts[:guest]) unless opts[:guest]==nil @instructor = @instructor.merge(opts[:instructor]) unless opts[:instructor]==nil @student = @student.merge(opts[:student]) unless opts[:student]==nil @teaching_assistant = @teaching_assistant.merge(opts[:teaching_assistant]) unless opts[:teaching_assistant]==nil end |