Class: PuavoRest::DeviceImages

Inherits:
PuavoSinatra show all
Defined in:
resources/device_images.rb

Constant Summary

Constant Summary

Constants inherited from PuavoSinatra

PuavoSinatra::ROOT

Instance Method Summary (collapse)

Methods inherited from PuavoSinatra

#auth, #basic_auth, #flog, #flog=, #from_post, #json_params, #kerberos, #legacy_server_auth, #limit, #pw_mgmt_server_auth, #server_auth, #txt

Instance Method Details

- (Object) all_images



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'resources/device_images.rb', line 10

def all_images
  images = [organisation_image]

  [School, BootServer, LtspServer].each do |model|
    model.all.each do |s|
        images.push s.get_own(:preferred_image)
      end
  end

  Device.all.each do |s|
    images.push s.get_own(:preferred_image)
    images.push s.get_own(:preferred_boot_image)
  end

  images
end

- (Object) by_boot_servers(boot_servers)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'resources/device_images.rb', line 27

def by_boot_servers(boot_servers)
  images = [organisation_image]

  boot_servers.each do |boot_server|
    images.push(boot_server.get_own(:preferred_image))

    boot_server.schools.each do |school|
      images.push(school.get_own(:preferred_image))

      school.devices.each do |device|
        images.push(device.get_own(:preferred_image))
        images.push(device.get_own(:preferred_boot_image))
      end

      school.ltsp_servers.each do |ltsp_server|
        images.push(ltsp_server.get_own(:preferred_image))
      end

    end
  end

  images
end

- (Object) organisation_image



5
6
7
# File 'resources/device_images.rb', line 5

def organisation_image
  Organisation.current(:no_cache).get_own(:preferred_image)
end