From 268ca04a699e2a782c540cee35dce2b80dacc56a Mon Sep 17 00:00:00 2001 From: jomu Date: Tue, 13 Oct 2015 11:15:49 +0000 Subject: [PATCH] minor improvements --- .../sharepoint/api/ServiceLogHandler.java | 2 - .../sharepoint/api/usergroup/SPUserGroup.java | 16 ++++--- .../api/src/main/resources/xsd/usergroup.xsd | 47 ++++++++++--------- 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/sharepoint/api/src/main/java/de/muehlencord/shared/sharepoint/api/ServiceLogHandler.java b/sharepoint/api/src/main/java/de/muehlencord/shared/sharepoint/api/ServiceLogHandler.java index 7503f23..a8a7a4d 100644 --- a/sharepoint/api/src/main/java/de/muehlencord/shared/sharepoint/api/ServiceLogHandler.java +++ b/sharepoint/api/src/main/java/de/muehlencord/shared/sharepoint/api/ServiceLogHandler.java @@ -13,8 +13,6 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -; - /** * * @author joern.muehlencord diff --git a/sharepoint/api/src/main/java/de/muehlencord/shared/sharepoint/api/usergroup/SPUserGroup.java b/sharepoint/api/src/main/java/de/muehlencord/shared/sharepoint/api/usergroup/SPUserGroup.java index d978059..4e99e37 100644 --- a/sharepoint/api/src/main/java/de/muehlencord/shared/sharepoint/api/usergroup/SPUserGroup.java +++ b/sharepoint/api/src/main/java/de/muehlencord/shared/sharepoint/api/usergroup/SPUserGroup.java @@ -42,7 +42,7 @@ public class SPUserGroup extends SPObject { public void addUserToGroup(String userLoginName, String groupName) throws JAXBException, SAXException, ParserConfigurationException, NoSuchAlgorithmException, IOException, KeyManagementException { - SPUser user = getUser(userLoginName); + SPUser user = getUser("i:0#.w|", userLoginName); if (user == null) { 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, JAXBException, SAXException { - SPUser user = getUser(userLoginName); + SPUser user = getUser("i:0#.w|", userLoginName); if (user == null) { 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 { - SPUser user = getUser(userLoginName); + SPUser user = getUser("i:0#.w|", userLoginName); if (user == null) { return null; } else { @@ -125,7 +125,7 @@ public class SPUserGroup extends SPObject { } 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) { return null; } else { @@ -155,8 +155,12 @@ public class SPUserGroup extends SPObject { return null; } - private SPUser getUser(String userLoginName) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException { - GetUserInfoResponse.GetUserInfoResult result = getUserGroupPort().getUserInfo("i:0#.w|" + userLoginName); + public SPUser getUserFromId(String userId) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, JAXBException, SAXException { + 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? if (result.getContent() != null) { diff --git a/sharepoint/api/src/main/resources/xsd/usergroup.xsd b/sharepoint/api/src/main/resources/xsd/usergroup.xsd index bc447f4..3f491a8 100644 --- a/sharepoint/api/src/main/resources/xsd/usergroup.xsd +++ b/sharepoint/api/src/main/resources/xsd/usergroup.xsd @@ -1,27 +1,28 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +