Class: Mdm::Enrollment::ProfilesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/mdm/management/profiles_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/mdm/management/profiles_controller.rb', line 11

def create
  service = Enrollment::CreateProfile.new
  service.params = params.except(:devices)

  if params[:devices]
    service.devices = Device.where(serial_number: params.require[:devices])
  end

  service.start
  render json: service.result
end

#indexObject



6
7
8
9
# File 'app/controllers/mdm/management/profiles_controller.rb', line 6

def index
  @profiles = Profile.all
  render json: { profiles: @profiles }
end

#updateObject



23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/mdm/management/profiles_controller.rb', line 23

def update
  @profile = Mdm::Profile.find(params[:id])

  service = Mdm::Enrollment::AssignProfile.new
  service.profile = @profile
  service.devices = Mdm::Device.where(serial_number: params.require(:devices))
  service.start

  render json: service.result
end