class TableauServerClient::Resources::User

Attributes

external_auth_user_id[R]
full_name[R]
id[R]
last_login[R]
name[R]
site_role[R]

Public Class Methods

from_collection_response(client, path, xml) { |from_response(client, "#{path}/#{id}", s)| ... } click to toggle source
# File lib/tableau_server_client/resources/user.rb, line 15
def self.from_collection_response(client, path, xml)
  xml.xpath("//xmlns:users/xmlns:user").each do |s|
    id = s['id']
    yield from_response(client, "#{path}/#{id}", s)
  end
end
from_response(client, path, xml) click to toggle source
# File lib/tableau_server_client/resources/user.rb, line 10
def self.from_response(client, path, xml)
  attrs = extract_attributes(xml)
  new(client, path, attrs)
end

Public Instance Methods

datasources() click to toggle source
# File lib/tableau_server_client/resources/user.rb, line 36
def datasources
  @client.get_collection(Datasource.location(site_path, filter: ["ownerName:eq:#{full_name}"])).select do |d|
    d.owner.id == id
  end
end
location() click to toggle source
# File lib/tableau_server_client/resources/user.rb, line 55
def location
  User.location(site_path, id)
end
reload() click to toggle source
# File lib/tableau_server_client/resources/user.rb, line 22
def reload
  @client.get location
end
to_request() click to toggle source
# File lib/tableau_server_client/resources/user.rb, line 42
def to_request
  request = build_request {|b|
    b.user(siteRole: site_role)
  }
end
update_site_role!(role) click to toggle source
# File lib/tableau_server_client/resources/user.rb, line 48
def update_site_role!(role)
  @site_role = role
  # Using location to get corretct path
  # When initialized from Group path will be groups/group_id/users/user_id
  @client.update(self, path: location.path)
end
workbooks() click to toggle source
# File lib/tableau_server_client/resources/user.rb, line 30
def workbooks
  @client.get_collection(Workbook.location(site_path, filter: ["ownerName:eq:#{full_name}"])).select do |w|
    w.owner.id == id
  end
end