minor improvements

This commit is contained in:
jomu
2015-10-13 11:15:49 +00:00
parent 6ac95e1e9d
commit 268ca04a69
3 changed files with 34 additions and 31 deletions

View File

@ -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

View File

@ -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) {

View File

@ -21,6 +21,7 @@
<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:attribute name="arg1" use="optional"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:schema> </xs:schema>