Method: ICFS::Api#access_list

Defined in:
lib/icfs/api.rb

#access_list(cid) ⇒ Set<String>

Get an access list

Parameters:

  • cid (String)

    caseid

Returns:

  • (Set<String>)

    the perms granted the user for this case

Raises:



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/icfs/api.rb', line 199

def access_list(cid)
  if !@access.key?(cid)

    # get grants for the case
    cse = case_read(cid)
    al = Set.new
    cse['access'].each do |ac|
      gs = Set.new(ac['grant'])
      al.add(ac['perm']) if @urg.intersect?(gs)
    end

    # higher perms imply lower ones
    al.add(ICFS::PermRead) if al.include?(ICFS::PermManage)
    al.add(ICFS::PermWrite) if al.include?(ICFS::PermAction)
    al.add(ICFS::PermRead) if al.include?(ICFS::PermWrite)

    # merge in global perms
    al.merge @perms

    @access[cid] = al
  end
  return @access[cid]
end