Module: IMS::LTI::DeprecatedRoleChecks

Included in:
ToolProvider
Defined in:
lib/ims/lti/deprecated_role_checks.rb

Instance Method Summary collapse

Instance Method Details

#admin?Boolean

Convenience method for checking if the user has ‘administrator’ role

Returns:

  • (Boolean)


43
44
45
# File 'lib/ims/lti/deprecated_role_checks.rb', line 43

def admin?
  has_role?('administrator')
end

#content_developer?Boolean

Convenience method for checking if the user has ‘contentdeveloper’ role

Returns:

  • (Boolean)


23
24
25
# File 'lib/ims/lti/deprecated_role_checks.rb', line 23

def content_developer?
  has_role?('ContentDeveloper')
end

#has_role?(role) ⇒ Boolean

Check whether the Launch Parameters have a role

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/ims/lti/deprecated_role_checks.rb', line 7

def has_role?(role)
  role = role.downcase
  @roles && @roles.any?{|r| r.index(role)}
end

#instructor?Boolean

Convenience method for checking if the user has ‘instructor’ or ‘faculty’ or ‘staff’ role

Returns:

  • (Boolean)


18
19
20
# File 'lib/ims/lti/deprecated_role_checks.rb', line 18

def instructor?
  has_role?('instructor') || has_role?('faculty') || has_role?('staff')
end

#manager?Boolean

Convenience method for checking if the user has ‘Manager’ role

Returns:

  • (Boolean)


33
34
35
# File 'lib/ims/lti/deprecated_role_checks.rb', line 33

def manager?
  has_role?('Manager')
end

#member?Boolean

Convenience method for checking if the user has ‘Member’ role

Returns:

  • (Boolean)


28
29
30
# File 'lib/ims/lti/deprecated_role_checks.rb', line 28

def member?
  has_role?('Member')
end

#mentor?Boolean

Convenience method for checking if the user has ‘Mentor’ role

Returns:

  • (Boolean)


38
39
40
# File 'lib/ims/lti/deprecated_role_checks.rb', line 38

def mentor?
  has_role?('Mentor')
end

#student?Boolean

Convenience method for checking if the user has ‘learner’ or ‘student’ role

Returns:

  • (Boolean)


13
14
15
# File 'lib/ims/lti/deprecated_role_checks.rb', line 13

def student?
  has_role?('learner') || has_role?('student')
end

#ta?Boolean

Convenience method for checking if the user has ‘TeachingAssistant’ role

Returns:

  • (Boolean)


48
49
50
# File 'lib/ims/lti/deprecated_role_checks.rb', line 48

def ta?
  has_role?('TeachingAssistant')
end