Method: Aptible::Auth::Role#set_account_permissions

Defined in:
lib/aptible/auth/role.rb

#set_account_permissions(account, scopes) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/aptible/auth/role.rb', line 18

def (, scopes)
  permissions = ()

  permissions.each { |p| p.destroy unless scopes.include? p.scope }
  existing = permissions.keep_if { |p| scopes.include? p.scope }

  new_scopes = scopes - existing.map(&:scope)
  (, new_scopes)
end