Class: Viewpoint::SPWS::Websvc::UserGroup
- Inherits:
-
Object
- Object
- Viewpoint::SPWS::Websvc::UserGroup
- Includes:
- WebServiceBase
- Defined in:
- lib/viewpoint/spws/websvc/user_group.rb
Overview
This class represents the Sharepoint User and Groups Web Service.
Constant Summary
Constants included from WebServiceBase
Constants included from Viewpoint::SPWS
Instance Attribute Summary
Attributes included from WebServiceBase
Attributes included from Viewpoint::SPWS
Instance Method Summary collapse
- #get_all_user_collection_from_web ⇒ Object
-
#get_user_info(user) ⇒ Object
Returns information about a specified user.
-
#get_user_login_from_email(emails) ⇒ Hash
Get user logins from e-mail addresses.
-
#initialize(spcon) ⇒ UserGroup
constructor
A new instance of UserGroup.
Methods included from Viewpoint::SPWS
Constructor Details
#initialize(spcon) ⇒ UserGroup
Returns a new instance of UserGroup.
24 25 26 27 28 |
# File 'lib/viewpoint/spws/websvc/user_group.rb', line 24 def initialize(spcon) @default_ns = 'http://schemas.microsoft.com/sharepoint/soap/directory/' @ws_endpoint = '_vti_bin/UserGroup.asmx' super end |
Instance Method Details
#get_all_user_collection_from_web ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/viewpoint/spws/websvc/user_group.rb', line 30 def get_all_user_collection_from_web soapmsg = build_soap_envelope do |type, builder| if(type == :header) else builder.GetAllUserCollectionFromWeb { builder.parent.default_namespace = @default_ns } end end soaprsp = Nokogiri::XML(send_soap_request(soapmsg.doc.to_xml)) ns = {'xmlns' => @default_ns} users = [] soaprsp.xpath('//xmlns:Users/xmlns:User', ns).each do |li| users << Types::User.new(self,li) end users end |
#get_user_info(user) ⇒ Object
Returns information about a specified user
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/viewpoint/spws/websvc/user_group.rb', line 51 def get_user_info(user) soapmsg = build_soap_envelope do |type, builder| if(type == :header) else builder.GetUserInfo { builder.parent.default_namespace = @default_ns builder.userLoginName(user) } end end soaprsp = Nokogiri::XML(send_soap_request(soapmsg.doc.to_xml)) ns = {'xmlns' => @default_ns} user = soaprsp.xpath('//xmlns:GetUserInfo/xmlns:User', ns).first Types::User.new(self,user) end |
#get_user_login_from_email(emails) ⇒ Hash
Get user logins from e-mail addresses
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/viewpoint/spws/websvc/user_group.rb', line 71 def get_user_login_from_email(emails) soapmsg = build_soap_envelope do |type, builder| if(type == :header) else builder.GetUserLoginFromEmail { builder.parent.default_namespace = @default_ns builder.emailXml { builder.Users { emails.each do |email| builder.User(:Email => email) end } } } end end soaprsp = Nokogiri::XML(send_soap_request(soapmsg.doc.to_xml)) ns = {'xmlns' => @default_ns} logins = {} soaprsp.xpath('//xmlns:GetUserLoginFromEmail/xmlns:User', ns).each do |li| logins[li['Email']] = li['Login'] end logins end |