Class: Mumukit::Auth::Permissions::Change

Inherits:
Object
  • Object
show all
Defined in:
lib/mumuki/classroom/permissions_diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(role, grant, change_type) ⇒ Change

Returns a new instance of Change.



21
22
23
24
25
# File 'lib/mumuki/classroom/permissions_diff.rb', line 21

def initialize(role, grant, change_type)
  @role = role
  @grant = grant
  @type = change_type
end

Instance Attribute Details

#grantObject

Returns the value of attribute grant.



19
20
21
# File 'lib/mumuki/classroom/permissions_diff.rb', line 19

def grant
  @grant
end

#roleObject

Returns the value of attribute role.



19
20
21
# File 'lib/mumuki/classroom/permissions_diff.rb', line 19

def role
  @role
end

#typeObject

Returns the value of attribute type.



19
20
21
# File 'lib/mumuki/classroom/permissions_diff.rb', line 19

def type
  @type
end

Instance Method Details

#as_json(options = {}) ⇒ Object



39
40
41
# File 'lib/mumuki/classroom/permissions_diff.rb', line 39

def as_json(options = {})
  {role: @role, grant: @grant, type: @type}.as_json options
end

#descriptionObject



27
28
29
# File 'lib/mumuki/classroom/permissions_diff.rb', line 27

def description
  "#{role}_#{type}"
end

#granted_slugObject



35
36
37
# File 'lib/mumuki/classroom/permissions_diff.rb', line 35

def granted_slug
  grant.to_mumukit_slug
end

#organizationObject



31
32
33
# File 'lib/mumuki/classroom/permissions_diff.rb', line 31

def organization
  granted_slug.organization
end