Sha256: f8d837f82e8eb2d73b47082591f7d240d9e88d73b758671ae34cc4b9e119fc9e
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module CanvasSync::Concerns module Account # Add some basic methods for querying for Roles and Permissions # based on the LTI Launch parameters module LaunchQuerying extend ActiveSupport::Concern included do scope :built_in, -> { where(workflow_state: 'built_in') } # Find Role(s) with the given label(s) scope :with_label, ->(labels) { labels = labels.split(',') if labels.is_a?(String) built_in_labels = [] custom_labels = [] Array(labels).each do |l| end custom_labels = Array(labels).reject do |l| if role_is_default?(l) built_ins << l elsif l == 'Account Admin' built_ins << 'AccountMembership' else next end true end where(workflow_state: 'built_in', base_role_type: built_ins) .or(where.not(workflow_state: 'built_in').where(label: custom_labels)) } end class_methods do def all_permissions(labels) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems