Class: ActiveSP::Group

Inherits:
Base
  • Object
show all
Extended by:
Caching, PersistentCaching
Includes:
InSite, Util
Defined in:
lib/activesp/group.rb

Instance Method Summary collapse

Methods inherited from Base

#attribute, #attribute_type, #attribute_types, #attributes, #has_attribute?, #has_writable_attribute?, #method_missing, #reload, #set_attribute

Constructor Details

#initialize(site, name) ⇒ Group

Returns a new instance of Group.



37
38
39
# File 'lib/activesp/group.rb', line 37

def initialize(site, name)
  @site, @name = site, name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveSP::Base

Instance Method Details

#is_role?Boolean

Returns false. The same method is present on Role where it returns true. Roles and groups can generally be duck-typed, and this method is there for the rare case where you do need to make the distinction

Returns:

  • (Boolean)


60
61
62
# File 'lib/activesp/group.rb', line 60

def is_role?
  false
end

#keyString

See Base#key

Returns:

  • (String)


43
44
45
# File 'lib/activesp/group.rb', line 43

def key
  encode_key("G", [@name])
end

#savevoid

This method returns an undefined value.

See Base#save



66
67
68
# File 'lib/activesp/group.rb', line 66

def save
  p untype_cast_attributes(@site, nil, internal_attribute_types, changed_attributes)
end

#to_sObject Also known as: inspect



71
72
73
# File 'lib/activesp/group.rb', line 71

def to_s
  "#<ActiveSP::Group name=#{@name}>"
end

#usersUser

Returns the list of users in this group

Returns:



49
50
51
52
53
54
# File 'lib/activesp/group.rb', line 49

def users
  call("UserGroup", "get_user_collection_from_group", "groupName" => @name).xpath("//spdir:User", NS).map do |row|
    attributes = clean_attributes(row.attributes)
    User.new(@site, attributes["LoginName"])
  end
end