educatic-info/bin/nextcloud/03-show-user-info.rb

24 lines
591 B
Ruby
Raw Normal View History

2022-12-01 15:22:21 +01:00
#!/usr/bin/env ruby
require_relative "lib"
2022-12-01 16:24:01 +01:00
settings = get_settings()
2022-12-01 15:22:21 +01:00
nextcloud = get_nextcloud_object()
ocs = nextcloud.ocs
2022-12-01 16:24:01 +01:00
user = ocs.user.find(settings["USERNAME"])
2022-12-01 15:22:21 +01:00
tags = %i(enabled id quota email displayname phone address website twitter groups language meta)
puts "User:"
tags.each do |tag|
value = user.send(tag)
puts "#{tag.to_s.rjust(12)} = #{value.to_s}"
end
puts "\nAdmin:"
groups = ocs.group.all
puts " groups : #{groups}"
# => ["admin", "group1", "group2"]
meta = groups.meta
puts " meta : #{meta}"
# => {"status"=>"ok", "statuscode"=>"200", "message"=>"OK"}