Module: ActiveSP::Root

Extended by:
Caching
Included in:
Connection
Defined in:
lib/activesp/root.rb

Instance Method Summary collapse

Instance Method Details

#group(name) ⇒ Object



77
78
79
80
81
# File 'lib/activesp/root.rb', line 77

def group(name)
  if group = groups_by_name[name]
    group
  end
end

#groupsArray<Group>

Returns the list of groups in the system

Returns:



69
70
71
72
73
74
# File 'lib/activesp/root.rb', line 69

def groups
  root.send(:call, "UserGroup", "get_group_collection_from_site").xpath("//spdir:Group", NS).map do |row|
    attributes = clean_attributes(row.attributes)
    Group.new(root, attributes["Name"])
  end
end

#rolesArray<Role>

Returns the list of roles in the system

Returns:



85
86
87
88
89
90
# File 'lib/activesp/root.rb', line 85

def roles
  root.send(:call, "UserGroup", "get_role_collection_from_web").xpath("//spdir:Role", NS).map do |row|
    attributes = clean_attributes(row.attributes)
    Role.new(root, attributes["Name"])
  end
end

#rootSite

Returns the root site as an object of class Site

Returns:



41
42
43
# File 'lib/activesp/root.rb', line 41

def root
  Site.new(self, @root_url)
end

#user(login) ⇒ User?

Returns the user with the given login, or nil when the user does not exist

Parameters:

  • login (String)

    The login of the user

Returns:



59
60
61
62
63
64
65
# File 'lib/activesp/root.rb', line 59

def user()
  if user = []
    user
  elsif data = root.send(:call, "UserGroup", "get_user_info", "userLoginName" => ).xpath("//spdir:User", NS).first
    [] = User.new(root, , clean_attributes(data))
  end
end

#usersArray<User>

Returns the list of users in the system

Returns:



48
49
50
51
52
53
# File 'lib/activesp/root.rb', line 48

def users
  root.send(:call, "UserGroup", "get_user_collection_from_site").xpath("//spdir:User", NS).map do |row|
    attributes = clean_attributes(row.attributes)
    User.new(root, attributes["LoginName"])
  end
end