Class: PandaPal::Session::RoleStore
- Inherits:
-
Object
- Object
- PandaPal::Session::RoleStore
- Defined in:
- app/models/panda_pal/session.rb
Constant Summary collapse
- ContextTypeURN =
'urn:lti:context-type:ims/lis/'.freeze
- ROLE_TYPES =
[ { type: "system", urn: "urn:lti:sysrole:ims/lis/", url: "http://purl.imsglobal.org/vocab/lis/v2/system/person#" }, { type: "institution", urn: "urn:lti:instrole:ims/lis/", url: "http://purl.imsglobal.org/vocab/lis/v2/institution/person#" }, { type: "context", urn: "urn:lti:role:ims/lis/", url: "http://purl.imsglobal.org/vocab/lis/v2/membership#" }, ]
Instance Attribute Summary collapse
-
#context_types ⇒ Object
Returns the value of attribute context_types.
-
#other_roles ⇒ Object
Returns the value of attribute other_roles.
-
#roles ⇒ Object
Returns the value of attribute roles.
Instance Method Summary collapse
- #context_roles ⇒ Object
-
#initialize(roles = '') ⇒ RoleStore
constructor
A new instance of RoleStore.
- #institution_roles ⇒ Object
- #system_roles ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(roles = '') ⇒ RoleStore
Returns a new instance of RoleStore.
288 289 290 291 292 293 294 295 296 297 |
# File 'app/models/panda_pal/session.rb', line 288 def initialize(roles = '') roles = roles.split(',') if roles.is_a?(String) @roles = roles || [] @context_types = [] @other_roles = [] @parsed_roles = HashWithIndifferentAccess.new map_roles end |
Instance Attribute Details
#context_types ⇒ Object
Returns the value of attribute context_types.
286 287 288 |
# File 'app/models/panda_pal/session.rb', line 286 def context_types @context_types end |
#other_roles ⇒ Object
Returns the value of attribute other_roles.
286 287 288 |
# File 'app/models/panda_pal/session.rb', line 286 def other_roles @other_roles end |
#roles ⇒ Object
Returns the value of attribute roles.
286 287 288 |
# File 'app/models/panda_pal/session.rb', line 286 def roles @roles end |
Instance Method Details
#context_roles ⇒ Object
301 |
# File 'app/models/panda_pal/session.rb', line 301 def context_roles; @parsed_roles[:context] || []; end |
#institution_roles ⇒ Object
300 |
# File 'app/models/panda_pal/session.rb', line 300 def institution_roles; @parsed_roles[:institution] || []; end |
#system_roles ⇒ Object
299 |
# File 'app/models/panda_pal/session.rb', line 299 def system_roles; @parsed_roles[:system] || []; end |
#to_h ⇒ Object
303 304 305 306 307 308 309 310 311 |
# File 'app/models/panda_pal/session.rb', line 303 def to_h { 'roles' => roles, 'context_type' => context_types, 'system_roles' => system_roles, 'institution_roles' => institution_roles, 'context_roles' => context_roles } end |