syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/2] syncope git commit: [SYNCOPE-946] Same fix for enduser
Date Mon, 03 Oct 2016 10:51:58 GMT
[SYNCOPE-946] Same fix for enduser


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/b244c614
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/b244c614
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/b244c614

Branch: refs/heads/master
Commit: b244c6144dd73d26b89e50461f0785d2040df214
Parents: cca8951
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Mon Oct 3 12:49:55 2016 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Mon Oct 3 12:51:51 2016 +0200

----------------------------------------------------------------------
 .../enduser/resources/SchemaResource.java       | 12 +++++
 .../app/js/controllers/UserController.js        |  1 -
 .../app/views/dynamicPlainAttribute.html        | 53 +++++++++++++++++---
 3 files changed, 59 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/b244c614/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
index 605426a..e60a0a7 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
@@ -23,10 +23,12 @@ import java.util.Collections;
 import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.ComparatorUtils;
 import org.apache.commons.collections4.IterableUtils;
 import org.apache.commons.collections4.Predicate;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
 import org.apache.syncope.client.enduser.model.SchemaResponse;
+import org.apache.syncope.common.lib.EntityTOUtils;
 import org.apache.syncope.common.lib.to.AbstractSchemaTO;
 import org.apache.syncope.common.lib.to.AnyTypeTO;
 import org.apache.syncope.common.lib.to.GroupTO;
@@ -125,6 +127,16 @@ public class SchemaResource extends AbstractBaseResource {
                 }
             }
 
+            Collections.sort(plainSchemas, ComparatorUtils.transformedComparator(
+                    ComparatorUtils.<String>naturalComparator(),
+                    EntityTOUtils.keyTransformer()));
+            Collections.sort(derSchemas, ComparatorUtils.transformedComparator(
+                    ComparatorUtils.<String>naturalComparator(),
+                    EntityTOUtils.keyTransformer()));
+            Collections.sort(virSchemas, ComparatorUtils.transformedComparator(
+                    ComparatorUtils.<String>naturalComparator(),
+                    EntityTOUtils.keyTransformer()));
+
             response.setWriteCallback(new AbstractResource.WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/b244c614/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 5e38b82..ebf5c81 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
@@ -276,7 +276,6 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope',
'$l
       };
 
       var removeUserSchemas = function (anyTypeClass, group) {
-
         //removing plain groupSchemas
         for (var i = 0; i < $scope.dynamicForm.groupSchemas.length; i++) {
           if ($scope.dynamicForm.groupSchemas[i] === group) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/b244c614/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
index 654c0de..fbdf0a2 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
@@ -22,18 +22,59 @@ under the License.
          ng-model="user.plainAttrs[schema.key].values[index]"
          ng-required="{{schema.mandatoryCondition}}" validate="true"
          ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)" name="{{schema.key}}"/>
-  <input ng-switch-when="Encrypted" class="form-control" type="text"
-         ng-model="user.plainAttrs[schema.key].values[index]"
-         ng-required="{{schema.mandatoryCondition}}" validate="true"
-         ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)"
-         ame="{{schema.key}}"/>
+
+  <div ng-switch-when="Encrypted" class="input-group input-group-sm">
+    <span class="input-group-btn">  
+      <button type="button" class="btn btn-default btn-flat"
+              onclick="var pwd = $(this).parent().next('input');
+                  if (pwd.is('[readonly]')) {
+                    if (pwd.val() === '') {
+                      pwd.removeAttr('readonly');
+                      $(this).children().attr('class', 'fa fa-unlock');
+                    } else {
+                      var response = confirm('This will remove the current value. Continue?');
+                      if (response == true) {
+                        pwd.removeAttr('readonly');
+                        pwd.val('');
+                        $(this).children().attr('class', 'fa fa-unlock');
+                      }
+                    }
+                  }
+              ">
+        <i class="fa fa-lock"></i>
+      </button>
+    </span>
+    <input class="form-control" type="password" readonly="true"
+           ng-model="user.plainAttrs[schema.key].values[index]"
+           ng-required="{{schema.mandatoryCondition}}" validate="true"
+           ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)" name="{{schema.key}}"/>
+    <span class="input-group-btn">  
+      <button type="button" class="btn btn-default btn-flat"
+              onmousedown="var pwd = $(this).parent().prev('input');
+                  if (!pwd.is('[readonly]')) {
+                    pwd.attr('type', 'text');
+                    $(this).children().attr('class', 'fa fa-eye-slash');
+                  }"
+              onmouseup="var pwd = $(this).parent().prev('input');
+                  if (!pwd.is('[readonly]')) {
+                    pwd.attr('type', 'password');
+                    $(this).children().attr('class', 'fa fa-eye');
+                  }"
+              >
+        <i class="fa fa-eye"></i>
+      </button>
+    </span>
+  </div>
+
   <div ng-switch-when="Boolean">
     <input type="checkbox" ng-model="user.plainAttrs[schema.key].values[index]" ng-required="{{schema.mandatoryCondition}}"

            ng-init="initAttribute(schema, index)" />
   </div>
+
   <input ng-switch-when="Long" class="form-control" type="number" ng-model="user.plainAttrs[schema.key].values[index]"

          ng-required="{{schema.mandatoryCondition}}" validate="true"
          ng-init="initAttribute(schema, index)" name="{{schema.key}}"/>
+
   <input ng-switch-when="Double" class="form-control" type="number" ng-model="user.plainAttrs[schema.key].values[index]"
          ng-required="{{schema.mandatoryCondition}}" validate="true"
          ng-init="initAttribute(schema, index)" name="{{schema.key}}"/>
@@ -72,7 +113,7 @@ under the License.
   </div>
 
   <div ng-switch-when="Binary" ng-init="initAttribute(schema, index)">
-    <input file-input type="file" id="fileInput" name="fileInput">
+    <input file-input type="file" id="fileInput" name="fileInput"/>
     <button type="button" title="Download file" class="fileButton btn btn-default btn-sm"
ng-click="download()">
       <i class="glyphicon glyphicon-download" ></i>
     </button>


Mime
View raw message