minor improvements
This commit is contained in:
@ -13,8 +13,6 @@ import org.apache.logging.log4j.Level;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author joern.muehlencord
|
* @author joern.muehlencord
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class SPUserGroup extends SPObject {
|
|||||||
|
|
||||||
public void addUserToGroup(String userLoginName, String groupName) throws JAXBException, SAXException, ParserConfigurationException,
|
public void addUserToGroup(String userLoginName, String groupName) throws JAXBException, SAXException, ParserConfigurationException,
|
||||||
NoSuchAlgorithmException, IOException, KeyManagementException {
|
NoSuchAlgorithmException, IOException, KeyManagementException {
|
||||||
SPUser user = getUser(userLoginName);
|
SPUser user = getUser("i:0#.w|", userLoginName);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new SAXException("User not found");
|
throw new SAXException("User not found");
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ public class SPUserGroup extends SPObject {
|
|||||||
|
|
||||||
public void removeUserFromGroup(String userLoginName, String groupName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException,
|
public void removeUserFromGroup(String userLoginName, String groupName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException,
|
||||||
JAXBException, SAXException {
|
JAXBException, SAXException {
|
||||||
SPUser user = getUser(userLoginName);
|
SPUser user = getUser("i:0#.w|", userLoginName);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new SAXException("User not found");
|
throw new SAXException("User not found");
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ public class SPUserGroup extends SPObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getUserId(String userLoginName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
|
public String getUserId(String userLoginName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
|
||||||
SPUser user = getUser(userLoginName);
|
SPUser user = getUser("i:0#.w|", userLoginName);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -125,7 +125,7 @@ public class SPUserGroup extends SPObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName(String userLoginName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
|
public String getUserName(String userLoginName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
|
||||||
SPUser user = getUser(userLoginName);
|
SPUser user = getUser("i:0#.w|", userLoginName);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -155,8 +155,12 @@ public class SPUserGroup extends SPObject {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SPUser getUser(String userLoginName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
|
public SPUser getUserFromId(String userId) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
|
||||||
GetUserInfoResponse.GetUserInfoResult result = getUserGroupPort().getUserInfo("i:0#.w|" + userLoginName);
|
return getUser ("i:0#.w|", userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SPUser getUser(Object prefix, String userLoginName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException {
|
||||||
|
GetUserInfoResponse.GetUserInfoResult result = getUserGroupPort().getUserInfo(prefix + userLoginName);
|
||||||
// TODO why is i:0#.w| in front?
|
// TODO why is i:0#.w| in front?
|
||||||
|
|
||||||
if (result.getContent() != null) {
|
if (result.getContent() != null) {
|
||||||
|
|||||||
@ -1,27 +1,28 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/directory/">
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/directory/">
|
||||||
<xs:element name="Users">
|
<xs:element name="Users">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element maxOccurs="unbounded" ref="soap:User"/>
|
<xs:element maxOccurs="unbounded" ref="soap:User"/>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="User">
|
<xs:element name="User">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute name="Email" use="optional"/>
|
<xs:attribute name="Email" use="optional"/>
|
||||||
<xs:attribute name="Flags" use="optional" type="xs:integer"/>
|
<xs:attribute name="Flags" use="optional" type="xs:integer"/>
|
||||||
<xs:attribute name="ID" use="optional" type="xs:integer"/>
|
<xs:attribute name="ID" use="optional" type="xs:integer"/>
|
||||||
<xs:attribute name="IsDomainGroup" use="optional" type="xs:NCName"/>
|
<xs:attribute name="IsDomainGroup" use="optional" type="xs:NCName"/>
|
||||||
<xs:attribute name="IsSiteAdmin" use="optional" type="xs:NCName"/>
|
<xs:attribute name="IsSiteAdmin" use="optional" type="xs:NCName"/>
|
||||||
<xs:attribute name="LoginName" use="optional"/>
|
<xs:attribute name="LoginName" use="optional"/>
|
||||||
<xs:attribute name="Name" use="optional"/>
|
<xs:attribute name="Name" use="optional"/>
|
||||||
<xs:attribute name="Notes" use="optional"/>
|
<xs:attribute name="Notes" use="optional"/>
|
||||||
<xs:attribute name="Sid" use="optional"/>
|
<xs:attribute name="Sid" use="optional"/>
|
||||||
<xs:attribute name="DisplayName" use="optional"/>
|
<xs:attribute name="DisplayName" use="optional"/>
|
||||||
<xs:attribute name="Login" use="optional"/>
|
<xs:attribute name="Login" use="optional"/>
|
||||||
<xs:attribute name="SiteUser" use="optional"/>
|
<xs:attribute name="SiteUser" use="optional"/>
|
||||||
</xs:complexType>
|
<xs:attribute name="arg1" use="optional"/>
|
||||||
</xs:element>
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user