You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by gi...@apache.org on 2016/01/22 17:48:37 UTC
syncope git commit: [SYNCOPE-719] Removed duplicated TO classes
Repository: syncope
Updated Branches:
refs/heads/master 95709c9bd -> cc3accb13
[SYNCOPE-719] Removed duplicated TO classes
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/cc3accb1
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/cc3accb1
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/cc3accb1
Branch: refs/heads/master
Commit: cc3accb13e71060c7b7e3f234c9e79b62416a389
Parents: 95709c9
Author: giacomolm <gi...@hotmail.it>
Authored: Fri Jan 22 17:48:10 2016 +0100
Committer: giacomolm <gi...@hotmail.it>
Committed: Fri Jan 22 17:48:20 2016 +0100
----------------------------------------------------------------------
.../client/enduser/adapters/GroupTOAdapter.java | 41 ----
.../enduser/adapters/ResourceTOAdapter.java | 41 ----
.../client/enduser/adapters/UserTOAdapter.java | 89 -------
.../client/enduser/model/CaptchaRequest.java | 49 ----
.../client/enduser/model/GroupResponse.java | 45 ----
.../client/enduser/model/ResourceResponse.java | 45 ----
.../client/enduser/model/UserTORequest.java | 234 -------------------
.../resources/SyncopeAnyClassTypeResource.java | 6 +-
.../enduser/resources/SyncopeGroupResource.java | 6 +-
.../resources/SyncopeResourceResource.java | 6 +-
.../resources/UserSelfCreateResource.java | 22 +-
.../resources/UserSelfPasswordReset.java | 13 +-
.../enduser/resources/UserSelfReadResource.java | 8 +-
.../resources/UserSelfUpdateResource.java | 26 +--
.../resources/META-INF/resources/app/index.html | 3 +-
.../app/js/controllers/UserController.js | 26 +--
.../app/js/services/userSelfService.js | 21 +-
.../META-INF/resources/app/js/util/userUtil.js | 71 ++++++
18 files changed, 135 insertions(+), 617 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/GroupTOAdapter.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/GroupTOAdapter.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/GroupTOAdapter.java
deleted file mode 100644
index 280c4ea..0000000
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/GroupTOAdapter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.enduser.adapters;
-
-import java.util.List;
-import org.apache.syncope.client.enduser.model.GroupResponse;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GroupTOAdapter {
-
- private static final Logger LOG = LoggerFactory.getLogger(GroupTOAdapter.class);
-
- public GroupResponse fromGroupTO(final List<GroupTO> groupTOs) {
-
- GroupResponse groupTOResponse = new GroupResponse();
-
- for (GroupTO groupTO : groupTOs) {
- groupTOResponse.getGroups().put(groupTO.getKey(), groupTO.getName());
- }
-
- return groupTOResponse;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/ResourceTOAdapter.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/ResourceTOAdapter.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/ResourceTOAdapter.java
deleted file mode 100644
index 5245901..0000000
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/ResourceTOAdapter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.enduser.adapters;
-
-import java.util.List;
-import org.apache.syncope.client.enduser.model.ResourceResponse;
-import org.apache.syncope.common.lib.to.ResourceTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ResourceTOAdapter {
-
- private static final Logger LOG = LoggerFactory.getLogger(ResourceTOAdapter.class);
-
- public ResourceResponse fromResourceTO(final List<ResourceTO> resourceTOs) {
-
- ResourceResponse resourceTOResponse = new ResourceResponse();
-
- for (ResourceTO resourceTO : resourceTOs) {
- resourceTOResponse.getResources().add(resourceTO.getKey());
- }
-
- return resourceTOResponse;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/UserTOAdapter.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/UserTOAdapter.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/UserTOAdapter.java
deleted file mode 100644
index 5585a41..0000000
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/UserTOAdapter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.enduser.adapters;
-
-import org.apache.syncope.client.enduser.model.UserTORequest;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserTOAdapter {
-
- private static final Logger LOG = LoggerFactory.getLogger(UserTOAdapter.class);
-
- public UserTO fromUserTORequest(final UserTORequest userTORequest, final String oldSelfPassword) {
-
- final UserTO userTO = new UserTO();
- // set key if in update mode
- final Long key = userTORequest.getKey();
- if (key != null) {
- userTO.setKey(key);
- }
- // set username...
- userTO.setUsername(userTORequest.getUsername());
- // ...and password
- String requestPassword = userTORequest.getPassword();
- if (requestPassword == null || requestPassword.isEmpty()) {
- userTO.setPassword(oldSelfPassword == null ? null : oldSelfPassword);
- } else {
- userTO.setPassword(requestPassword);
- }
-
- //set security question and answer
- userTO.setSecurityQuestion(userTORequest.getSecurityQuestion());
- userTO.setSecurityAnswer(userTORequest.getSecurityAnswer());
- //set realm
- userTO.setRealm(userTORequest.getRealm());
- // add attributes
- userTO.getPlainAttrs().addAll(userTORequest.getPlainAttrs().values());
- userTO.getDerAttrs().addAll(userTORequest.getDerAttrs().values());
- userTO.getVirAttrs().addAll(userTORequest.getVirAttrs().values());
- // add resources
- userTO.getResources().addAll(userTORequest.getResources());
- // add memberships
- userTO.getMemberships().addAll(userTORequest.getMemberships());
- // add auxiliary classes
- userTO.getAuxClasses().addAll(userTORequest.getAuxClasses());
-
- return userTO;
- }
-
- public UserTORequest toUserTORequest(final UserTO userTO) {
-
- final UserTORequest userTORequest = new UserTORequest().
- key(userTO.getKey()).
- username(userTO.getUsername()).
- securityQuestion(userTO.getSecurityQuestion()).
- securityAnswer(userTO.getSecurityAnswer()).
- realm(userTO.getRealm());
-
- userTORequest.getPlainAttrs().putAll(userTO.getPlainAttrMap());
- userTORequest.getDerAttrs().putAll(userTO.getDerAttrMap());
- userTORequest.getVirAttrs().putAll(userTO.getVirAttrMap());
-
- userTORequest.getResources().addAll(userTO.getResources());
-
- userTORequest.getMemberships().addAll(userTO.getMemberships());
-
- userTORequest.getAuxClasses().addAll(userTO.getAuxClasses());
-
- return userTORequest;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/CaptchaRequest.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/CaptchaRequest.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/CaptchaRequest.java
deleted file mode 100644
index 3c05d34..0000000
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/CaptchaRequest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.enduser.model;
-
-import java.io.Serializable;
-
-public class CaptchaRequest implements Serializable {
-
- private static final long serialVersionUID = -8608459099587628110L;
-
- private String value;
-
- public CaptchaRequest() {
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(final String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- StringBuilder toStringBuilder;
- toStringBuilder = new StringBuilder("CaptchaRequest{");
- toStringBuilder.append("value=").append(this.value);
- toStringBuilder.append('}');
- return toStringBuilder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/GroupResponse.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/GroupResponse.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/GroupResponse.java
deleted file mode 100644
index 49c2992..0000000
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/GroupResponse.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.enduser.model;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-public class GroupResponse implements Serializable {
-
- private static final long serialVersionUID = -7499232727784886980L;
-
- private Map<Long, String> groups = new HashMap<>();
-
- public Map<Long, String> getGroups() {
- return groups;
- }
-
- public void setGroups(final Map<Long, String> groups) {
- this.groups = groups;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/ResourceResponse.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/ResourceResponse.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/ResourceResponse.java
deleted file mode 100644
index 77efecc..0000000
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/ResourceResponse.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.enduser.model;
-
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-public class ResourceResponse implements Serializable {
-
- private static final long serialVersionUID = -7499232727784886980L;
-
- private Set<String> resources = new HashSet<>();
-
- public Set<String> getResources() {
- return resources;
- }
-
- public void setResources(final Set<String> resources) {
- this.resources = resources;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/UserTORequest.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/UserTORequest.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/UserTORequest.java
deleted file mode 100644
index 375bc21..0000000
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/UserTORequest.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.enduser.model;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.MembershipTO;
-
-public class UserTORequest implements Serializable {
-
- private static final long serialVersionUID = -6763020920564016374L;
-
- private Long key;
-
- private String username;
-
- private String password;
-
- private Long securityQuestion;
-
- private String securityAnswer;
-
- private String realm;
-
- private Map<String, AttrTO> plainAttrs = new HashMap<>();
-
- private Map<String, AttrTO> derAttrs = new HashMap<>();
-
- private Map<String, AttrTO> virAttrs = new HashMap<>();
-
- private Set<String> resources = new HashSet<>();
-
- private List<MembershipTO> memberships = new ArrayList<>();
-
- private List<String> auxClasses = new ArrayList<>();
-
- private String captcha;
-
- public UserTORequest() {
- }
-
- public Long getKey() {
- return key;
- }
-
- public void setKey(final Long key) {
- this.key = key;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(final String username) {
- this.username = username;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(final String password) {
- this.password = password;
- }
-
- public Long getSecurityQuestion() {
- return securityQuestion;
- }
-
- public void setSecurityQuestion(final Long securityQuestion) {
- this.securityQuestion = securityQuestion;
- }
-
- public String getSecurityAnswer() {
- return securityAnswer;
- }
-
- public void setSecurityAnswer(final String securityAnswer) {
- this.securityAnswer = securityAnswer;
- }
-
- public String getRealm() {
- return realm;
- }
-
- public void setRealm(final String realm) {
- this.realm = realm;
- }
-
- public Map<String, AttrTO> getPlainAttrs() {
- return plainAttrs;
- }
-
- public void setPlainAttrs(final Map<String, AttrTO> plainAttrs) {
- this.plainAttrs = plainAttrs;
- }
-
- public Map<String, AttrTO> getDerAttrs() {
- return derAttrs;
- }
-
- public void setDerAttrs(final Map<String, AttrTO> derAttrs) {
- this.derAttrs = derAttrs;
- }
-
- public Map<String, AttrTO> getVirAttrs() {
- return virAttrs;
- }
-
- public void setVirAttrs(final Map<String, AttrTO> virAttrs) {
- this.virAttrs = virAttrs;
- }
-
- public Set<String> getResources() {
- return resources;
- }
-
- public void setResources(final Set<String> resources) {
- this.resources = resources;
- }
-
- public List<MembershipTO> getMemberships() {
- return memberships;
- }
-
- public void setMemberships(final List<MembershipTO> memberships) {
- this.memberships = memberships;
- }
-
- public List<String> getAuxClasses() {
- return this.auxClasses;
- }
-
- public void setAuxClasses(final List<String> auxClasses) {
- this.auxClasses = auxClasses;
- }
-
- public String getCaptcha() {
- return captcha;
- }
-
- public void setCaptcha(final String captcha) {
- this.captcha = captcha;
- }
-
- public UserTORequest key(final Long value) {
- this.key = value;
- return this;
- }
-
- public UserTORequest username(final String value) {
- this.username = value;
- return this;
- }
-
- public UserTORequest password(final String value) {
- this.password = value;
- return this;
- }
-
- public UserTORequest securityQuestion(final Long value) {
- this.securityQuestion = value;
- return this;
- }
-
- public UserTORequest securityAnswer(final String value) {
- this.securityAnswer = value;
- return this;
- }
-
- public UserTORequest realm(final String value) {
- this.realm = value;
- return this;
- }
-
- public UserTORequest plainAttrs(final Map<String, AttrTO> value) {
- this.plainAttrs = value;
- return this;
- }
-
- public UserTORequest derAttrs(final Map<String, AttrTO> value) {
- this.derAttrs = value;
- return this;
- }
-
- public UserTORequest virAttrs(final Map<String, AttrTO> value) {
- this.virAttrs = value;
- return this;
- }
-
- public UserTORequest resources(final Set<String> value) {
- this.resources = value;
- return this;
- }
-
- public UserTORequest auxClasses(final List<String> value) {
- this.auxClasses = value;
- return this;
- }
-
- public UserTORequest captcha(final String value) {
- this.captcha = value;
- return this;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeAnyClassTypeResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeAnyClassTypeResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeAnyClassTypeResource.java
index c2c3efc..2528150 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeAnyClassTypeResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeAnyClassTypeResource.java
@@ -23,7 +23,6 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
-import org.apache.syncope.client.enduser.adapters.GroupTOAdapter;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
import org.apache.syncope.core.misc.serialization.POJOHelper;
@@ -39,10 +38,7 @@ public class SyncopeAnyClassTypeResource extends AbstractBaseResource {
private final AnyTypeClassService anyTypeClassService;
- private final GroupTOAdapter groupTOAdapter;
-
- public SyncopeAnyClassTypeResource() {
- groupTOAdapter = new GroupTOAdapter();
+ public SyncopeAnyClassTypeResource() {
anyTypeClassService = SyncopeEnduserSession.get().getService(AnyTypeClassService.class);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java
index 21d050a..8ae82ce 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java
@@ -23,7 +23,6 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
-import org.apache.syncope.client.enduser.adapters.GroupTOAdapter;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.rest.api.beans.AnyListQuery;
@@ -41,10 +40,7 @@ public class SyncopeGroupResource extends AbstractBaseResource {
private final GroupService groupService;
- private final GroupTOAdapter groupTOAdapter;
-
public SyncopeGroupResource() {
- groupTOAdapter = new GroupTOAdapter();
groupService = SyncopeEnduserSession.get().getService(GroupService.class);
}
@@ -73,7 +69,7 @@ public class SyncopeGroupResource extends AbstractBaseResource {
@Override
public void writeData(final Attributes attributes) throws IOException {
- attributes.getResponse().write(POJOHelper.serialize(groupTOAdapter.fromGroupTO(groupTOs)));
+ attributes.getResponse().write(POJOHelper.serialize(groupTOs));
}
});
response.setStatusCode(Response.Status.OK.getStatusCode());
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeResourceResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeResourceResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeResourceResource.java
index 350d442..8d08ac2 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeResourceResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeResourceResource.java
@@ -23,7 +23,6 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
-import org.apache.syncope.client.enduser.adapters.ResourceTOAdapter;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.rest.api.service.ResourceService;
import org.apache.syncope.core.misc.serialization.POJOHelper;
@@ -40,10 +39,7 @@ public class SyncopeResourceResource extends AbstractBaseResource {
private final ResourceService resourceService;
- private final ResourceTOAdapter resourceTOAdapter;
-
public SyncopeResourceResource() {
- resourceTOAdapter = new ResourceTOAdapter();
resourceService = SyncopeEnduserSession.get().getService(ResourceService.class);
}
@@ -69,7 +65,7 @@ public class SyncopeResourceResource extends AbstractBaseResource {
@Override
public void writeData(final IResource.Attributes attributes) throws IOException {
- attributes.getResponse().write(POJOHelper.serialize(resourceTOAdapter.fromResourceTO(resourceTOs)));
+ attributes.getResponse().write(POJOHelper.serialize(resourceTOs));
}
});
response.setStatusCode(Response.Status.OK.getStatusCode());
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
index 57c2836..88059d6 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
@@ -23,8 +23,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
-import org.apache.syncope.client.enduser.adapters.UserTOAdapter;
-import org.apache.syncope.client.enduser.model.UserTORequest;
+import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.rest.api.service.UserSelfService;
import org.apache.syncope.core.misc.serialization.POJOHelper;
import org.slf4j.Logger;
@@ -38,10 +37,7 @@ public class UserSelfCreateResource extends AbstractBaseResource {
private final UserSelfService userSelfService;
- private final UserTOAdapter userTOAdapter;
-
public UserSelfCreateResource() {
- userTOAdapter = new UserTOAdapter();
userSelfService = SyncopeEnduserSession.get().getService(UserSelfService.class);
}
@@ -62,19 +58,19 @@ public class UserSelfCreateResource extends AbstractBaseResource {
String jsonString = request.getReader().readLine();
- final UserTORequest userTORequest = POJOHelper.deserialize(jsonString, UserTORequest.class);
+ final UserTO userTO = POJOHelper.deserialize(jsonString, UserTO.class);
- if (!captchaCheck(userTORequest.getCaptcha(), request.getSession().getAttribute(
+ if (!captchaCheck(request.getHeader("captcha"), request.getSession().getAttribute(
SyncopeEnduserConstants.CAPTCHA_SESSION_KEY).toString())) {
LOG.error("Entered captcha is not matching");
throw new Exception("Entered captcha is not matching");
}
- if (isSelfRegistrationAllowed() && userTORequest != null) {
- LOG.debug("Received user self registration request for user: [{}]", userTORequest.getUsername());
- LOG.trace("Received user self registration request is: [{}]", userTORequest);
+ if (isSelfRegistrationAllowed() && userTO != null) {
+ LOG.debug("Received user self registration request for user: [{}]", userTO.getUsername());
+ LOG.trace("Received user self registration request is: [{}]", userTO);
// adapt request and create user
- final Response res = userSelfService.create(userTOAdapter.fromUserTORequest(userTORequest, null), true);
+ final Response res = userSelfService.create(userTO, true);
response.setWriteCallback(new WriteCallback() {
@@ -82,7 +78,7 @@ public class UserSelfCreateResource extends AbstractBaseResource {
public void writeData(final Attributes attributes) throws IOException {
attributes.getResponse().write(res.getStatusInfo().getFamily().equals(
Response.Status.Family.SUCCESSFUL)
- ? responseMessage.append("User: ").append(userTORequest.getUsername()).append(
+ ? responseMessage.append("User: ").append(userTO.getUsername()).append(
" successfully created")
: new StringBuilder().append("ErrorMessage{{ ").
append(res.getStatusInfo().getReasonPhrase()).append(" }}"));
@@ -91,7 +87,7 @@ public class UserSelfCreateResource extends AbstractBaseResource {
response.setStatusCode(res.getStatus());
} else {
response.setError(Response.Status.FORBIDDEN.getStatusCode(), new StringBuilder().
- append("ErrorMessage{{").append(userTORequest == null
+ append("ErrorMessage{{").append(userTO == null
? "Request received is not valid }}"
: "Self registration not allowed }}").toString());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
index 28b7fcb..d17b636 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
@@ -56,12 +56,15 @@ public class UserSelfPasswordReset extends AbstractBaseResource {
}
Map<String, String[]> parameters = request.getParameterMap();
+ String username;
if (parameters.get("username") == null || parameters.get("username").length == 0) {
throw new Exception("A valid username should be provided");
+ } else {
+ username = parameters.get("username")[0];
}
- if (parameters.get("captcha") == null || parameters.get("captcha").length == 0 || !captchaCheck(parameters.
- get("captcha")[0], request.getSession().getAttribute(SyncopeEnduserConstants.CAPTCHA_SESSION_KEY).
+ if (request.getHeader("captcha") == null || !captchaCheck(request.getHeader("captcha"), request.
+ getSession().getAttribute(SyncopeEnduserConstants.CAPTCHA_SESSION_KEY).
toString())) {
LOG.error("Entered captcha is not matching");
throw new Exception("Entered captcha is not matching");
@@ -71,13 +74,13 @@ public class UserSelfPasswordReset extends AbstractBaseResource {
if (parameters.get("securityanswer") == null || parameters.get("securityanswer").length == 0) {
throw new Exception("A correct security answer should be provided");
}
- userSelfService.requestPasswordReset(parameters.get("username")[0],
+ userSelfService.requestPasswordReset(username,
parameters.get("securityanswer")[0]);
} else {
- userSelfService.requestPasswordReset(parameters.get("username")[0], null);
+ userSelfService.requestPasswordReset(username, null);
}
final String responseMessage = new StringBuilder().append("Password reset request sent for user ").append(
- parameters.get("username")[0]).toString();
+ username).toString();
response.setWriteCallback(new WriteCallback() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
index fc4413b..2cca020 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
-import org.apache.syncope.client.enduser.adapters.UserTOAdapter;
import org.apache.syncope.core.misc.serialization.POJOHelper;
import org.apache.wicket.request.resource.AbstractResource;
import org.apache.wicket.request.resource.IResource;
@@ -38,10 +37,8 @@ public class UserSelfReadResource extends AbstractBaseResource {
*/
private static final Logger LOG = LoggerFactory.getLogger(UserSelfReadResource.class);
- private final UserTOAdapter userTOAdapter;
-
public UserSelfReadResource() {
- userTOAdapter = new UserTOAdapter();
+
}
@Override
@@ -59,8 +56,7 @@ public class UserSelfReadResource extends AbstractBaseResource {
return response;
}
- final String selfTOJson = POJOHelper.serialize(userTOAdapter.toUserTORequest(SyncopeEnduserSession.get().
- getSelfTO()));
+ final String selfTOJson = POJOHelper.serialize(SyncopeEnduserSession.get().getSelfTO());
response.setWriteCallback(new WriteCallback() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
index a44d53e..d913e6e 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
@@ -21,15 +21,13 @@ package org.apache.syncope.client.enduser.resources;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
+import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
-import org.apache.syncope.client.enduser.adapters.UserTOAdapter;
-import org.apache.syncope.client.enduser.model.UserTORequest;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.rest.api.service.UserSelfService;
import org.apache.syncope.core.misc.serialization.POJOHelper;
import org.apache.wicket.request.resource.AbstractResource;
import org.apache.wicket.request.resource.IResource;
-import org.apache.wicket.util.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,10 +39,8 @@ public class UserSelfUpdateResource extends AbstractBaseResource {
private final UserSelfService userSelfService;
- private final UserTOAdapter userTOAdapter;
public UserSelfUpdateResource() {
- userTOAdapter = new UserTOAdapter();
userSelfService = SyncopeEnduserSession.get().getService(UserSelfService.class);
}
@@ -61,24 +57,26 @@ public class UserSelfUpdateResource extends AbstractBaseResource {
return response;
}
- final UserTORequest userTOResponse = POJOHelper.deserialize(IOUtils.toString(request.getInputStream()),
- UserTORequest.class);
+ String jsonString = request.getReader().readLine();
- LOG.trace("userTOResponse: {}", userTOResponse);
-
- // adapt user, change self password only value passed is not null and has changed
- UserTO userTO = userTOAdapter.fromUserTORequest(userTOResponse, SyncopeEnduserSession.get().getPassword());
+ final UserTO userTO = POJOHelper.deserialize(jsonString, UserTO.class);
+ if (!captchaCheck(request.getHeader("captcha"), request.getSession().getAttribute(
+ SyncopeEnduserConstants.CAPTCHA_SESSION_KEY).toString())) {
+ LOG.error("Entered captcha is not matching");
+ throw new Exception("Entered captcha is not matching");
+ }
+
LOG.debug("User {} id updating himself", userTO.getUsername());
// update user
Response res = userSelfService.update(userTO);
final String responseMessage = res.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)
- ? new StringBuilder().append("User").append(userTO.getUsername()).append(
+ ? new StringBuilder().append("User").append(userTO.getUsername()).append(
" successfully updated").toString()
- : new StringBuilder().append("ErrorMessage{{ ").
- append(res.getStatusInfo().getReasonPhrase()).append(" }}").toString();
+ : new StringBuilder().append("ErrorMessage{{ ").
+ append(res.getStatusInfo().getReasonPhrase()).append(" }}").toString();
response.setWriteCallback(new WriteCallback() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/resources/META-INF/resources/app/index.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/index.html b/client/enduser/src/main/resources/META-INF/resources/app/index.html
index 8a1370f..01b9846 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/index.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/index.html
@@ -113,7 +113,8 @@ under the License.
<script src="js/directives/auxClasses.js"></script>
<!--filters-->
<script src="js/filters/propsFilter.js"></script>
-
+ <!--util-->
+ <script src="js/util/userUtil.js"></script>
<link rel="shortcut icon" href="img/favicon.png" type="image/png"/>
<link href="css/login.css" rel="stylesheet" type="text/css" />
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
index b4b80ba..71f8054 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
@@ -21,9 +21,9 @@
angular.module("self").controller("UserController", ['$scope', '$rootScope', '$location', '$compile', 'AuthService',
'UserSelfService', 'SchemaService', 'RealmService', 'ResourceService', 'SecurityQuestionService', 'CaptchaService',
- 'GroupService', 'AnyService',
+ 'GroupService', 'AnyService', 'UserUtil',
function ($scope, $rootScope, $location, $compile, AuthService, UserSelfService, SchemaService, RealmService,
- ResourceService, SecurityQuestionService, CaptchaService, GroupService, AnyService) {
+ ResourceService, SecurityQuestionService, CaptchaService, GroupService, AnyService, UserUtil) {
$scope.user = {};
$scope.confirmPassword = {
@@ -179,7 +179,9 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
var initResources = function () {
ResourceService.getResources().then(function (response) {
- $scope.dynamicForm.resources = response.resources;
+ for (var i in response) {
+ $scope.dynamicForm.resources.push(response[i].key);
+ }
});
};
@@ -187,8 +189,8 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
var realm = $scope.user.realm || "/";
GroupService.getGroups(realm).then(function (response) {
$scope.dynamicForm.groups = new Array();
- for (var key in response.groups) {
- $scope.dynamicForm.groups.push({"rightKey": key, "groupName": response.groups[key]});
+ for (var i in response) {
+ $scope.dynamicForm.groups.push({"rightKey": response[i].key, "groupName": response[i].name});
}
}, function (e) {
$scope.showError("An error occur during retrieving groups " + e, $scope.notification)
@@ -217,7 +219,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
var readUser = function () {
UserSelfService.read().then(function (response) {
- $scope.user = response;
+ $scope.user = UserUtil.getUnwrappedUser(response);
$scope.user.password = undefined;
$scope.initialSecurityQuestion = $scope.user.securityQuestion;
// initialize already assigned resources
@@ -324,12 +326,12 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
$scope.saveUser = function (user) {
console.log("Save user: ", user);
- // setting captcha value while saving user
- user.captcha = $scope.captchaInput.value;
+
+ var wrappedUser = UserUtil.getWrappedUser(user);
if ($scope.createMode) {
- UserSelfService.create(user).then(function (response) {
+ UserSelfService.create(wrappedUser, $scope.captchaInput.value).then(function (response) {
console.log("Created user: ", response);
$scope.showSuccess("User " + $scope.user.username + " successfully created", $scope.notification);
$location.path('/self');
@@ -346,7 +348,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
} else {
- UserSelfService.update(user).then(function (response) {
+ UserSelfService.update(wrappedUser, $scope.captchaInput.value).then(function (response) {
console.log("Updated user: ", response);
AuthService.logout().then(function (response) {
console.log("LOGOUT SUCCESS: ", response);
@@ -392,9 +394,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
$scope.resetPassword = function (user) {
if (user && user.username) {
$scope.retrieveSecurityQuestion(user);
- // setting captcha value while saving user
- user.captcha = $scope.captchaInput.value;
- UserSelfService.passwordReset(user).then(function (data) {
+ UserSelfService.passwordReset(user,$scope.captchaInput.value).then(function (data) {
$scope.showSuccess(data, $scope.notification);
$location.path('/self');
}, function (response) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js b/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
index fc60c10..6a5206f 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
@@ -34,9 +34,12 @@ angular.module('login')
return $q.reject(response.data || response.statusText);
});
};
- userSelfService.create = function (user) {
+ userSelfService.create = function (user, captcha) {
return $http
- .post('/syncope-enduser/api/self/create', user)
+ .post('/syncope-enduser/api/self/create', user,
+ {
+ headers: {'captcha': captcha}
+ })
.then(function (response) {
console.log("response save: ", response);
var username = response;
@@ -45,9 +48,12 @@ angular.module('login')
return $q.reject(response.data || response.statusText);
});
};
- userSelfService.update = function (user) {
+ userSelfService.update = function (user, captcha) {
return $http
- .post('/syncope-enduser/api/self/update', user)
+ .post('/syncope-enduser/api/self/update', user,
+ {
+ headers: {'captcha': captcha}
+ })
.then(function (response) {
var username = response;
}, function (response) {
@@ -55,11 +61,14 @@ angular.module('login')
return $q.reject(response.data || response.statusText);
});
};
- userSelfService.passwordReset = function (user) {
+ userSelfService.passwordReset = function (user, captcha) {
return $http
.post('/syncope-enduser/api/self/requestPasswordReset', user,
{
- headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'},
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
+ 'captcha': captcha
+ },
transformRequest: function (obj) {
var str = [];
for (var p in obj)
http://git-wip-us.apache.org/repos/asf/syncope/blob/cc3accb1/client/enduser/src/main/resources/META-INF/resources/app/js/util/userUtil.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/util/userUtil.js b/client/enduser/src/main/resources/META-INF/resources/app/js/util/userUtil.js
new file mode 100644
index 0000000..57b0ad3
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/util/userUtil.js
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+'use strict';
+
+angular.module('SyncopeEnduserApp')
+ .factory('UserUtil', ['$resource', '$q',
+ function ($resource, $q) {
+
+ var userUtil = {};
+
+ //Prepare the user object passed as parameter to be compliant to the REST API.
+ //return a clone of the initial user with those modifications.
+ userUtil.getWrappedUser = function (user) {
+
+ var wrappedUser = $.extend(true, {}, user);
+
+ wrappedUser.plainAttrs = $.map(user.plainAttrs, function (el) {
+ return el
+ });
+ wrappedUser.derAttrs = $.map(user.derAttrs, function (el) {
+ return el
+ });
+ wrappedUser.virAttrs = $.map(user.virAttrs, function (el) {
+ return el
+ });
+ wrappedUser["@class"] = "org.apache.syncope.common.lib.to.UserTO";
+
+ return wrappedUser;
+ };
+
+ //Converts all the user attributes from an array of object to an associatice
+ userUtil.getUnwrappedUser = function (user) {
+
+ var unwrappedUser = $.extend(true, {}, user);
+
+ unwrappedUser.plainAttrs = {}
+ for (var i in user.plainAttrs) {
+ unwrappedUser.plainAttrs[user.plainAttrs[i].schema] = user.plainAttrs[i];
+ }
+ unwrappedUser.derAttrs = {}
+ for (var i in user.derAttrs) {
+ unwrappedUser.derAttrs[user.derAttrs[i].schema] = user.derAttrs[i];
+ }
+ unwrappedUser.virAttrs = {}
+ for (var i in user.virAttrs) {
+ unwrappedUser.virAttrs[user.virAttrs[i].schema] = user.virAttrs[i];
+ }
+
+ return unwrappedUser;
+ };
+
+ return userUtil;
+
+ }]);