ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject git commit: AMBARI-6347. Views : Admin - Update User Resources.
Date Tue, 01 Jul 2014 21:56:21 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 00a4991ee -> 97a5a9470


AMBARI-6347. Views : Admin - Update User Resources.


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

Branch: refs/heads/trunk
Commit: 97a5a947037821a5918e689994b35b0600cde5b4
Parents: 00a4991
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Tue Jul 1 14:55:37 2014 -0700
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Tue Jul 1 14:55:37 2014 -0700

----------------------------------------------------------------------
 .../ambari/server/api/services/UserService.java | 88 +++++++++++---------
 .../AmbariManagementControllerImpl.java         | 11 ++-
 .../ambari/server/controller/UserRequest.java   |  9 ++
 .../ambari/server/controller/UserResponse.java  |  7 +-
 .../internal/UserResourceProvider.java          |  8 ++
 .../ambari/server/orm/entities/UserEntity.java  | 17 ++++
 .../server/security/authorization/User.java     |  6 ++
 .../server/security/authorization/Users.java    | 14 ++++
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  2 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  2 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |  2 +-
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql     |  2 +-
 .../src/main/resources/properties.json          |  1 +
 .../internal/UserResourceProviderTest.java      |  2 +-
 14 files changed, 125 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
index c0a4976..1855978 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
@@ -48,12 +48,12 @@ public class UserService extends BaseService {
   @Produces("text/plain")
   public Response getUsers(@Context HttpHeaders headers, @Context UriInfo ui) {
     return handleRequest(headers, null, ui, Request.Type.GET, createUserResource(null));
-  } 
+  }
 
   /**
    * Gets a single user.
    * Handles: GET /users/{username} requests
-   * 
+   *
    * @param headers     http headers
    * @param ui          uri info
    * @param userName    the username
@@ -66,55 +66,67 @@ public class UserService extends BaseService {
       @PathParam("userName") String userName) {
     return handleRequest(headers, null, ui, Request.Type.GET, createUserResource(userName));
   }
-  
+
   /**
    * Creates a user.
-   * Handles: POST /users/{userName}
+   * Handles: POST /users
    *
    * @param headers     http headers
    * @param ui          uri info
-   * @param userName    the username
    * @return information regarding the created user
    */
-   @POST
-   @Path("{userName}")
-   @Produces("text/plain")
-   public Response createUser(String body, @Context HttpHeaders headers, @Context UriInfo
ui,
-                                 @PathParam("userName") String userName) {
+  @POST
+  @Produces("text/plain")
+  public Response createUser(String body, @Context HttpHeaders headers, @Context UriInfo
ui) {
+    return handleRequest(headers, body, ui, Request.Type.POST, createUserResource(null));
+  }
 
+  /**
+   * Creates a user.
+   * Handles: POST /users/{username}
+   *
+   * @param headers     http headers
+   * @param ui          uri info
+   * @param userName    the username
+   * @return information regarding the created user
+   */
+  @POST
+  @Path("{userName}")
+  @Produces("text/plain")
+  public Response createUser(String body, @Context HttpHeaders headers, @Context UriInfo
ui,
+      @PathParam("userName") String userName) {
     return handleRequest(headers, body, ui, Request.Type.POST, createUserResource(userName));
   }
-  
-   
-   /**
-    * Updates a specific user.
-    * Handles: PUT /users/{userName}
-    *
-    * @param headers     http headers
-    * @param ui          uri info
-    * @param userName   the username
-    * @return information regarding the updated user
-    */
-   @PUT
-   @Path("{userName}")
-   @Produces("text/plain")
-   public Response updateUser(String body, @Context HttpHeaders headers, @Context UriInfo
ui,
+
+  /**
+   * Updates a specific user.
+   * Handles: PUT /users/{userName}
+   *
+   * @param headers     http headers
+   * @param ui          uri info
+   * @param userName   the username
+   * @return information regarding the updated user
+   */
+  @PUT
+  @Path("{userName}")
+  @Produces("text/plain")
+  public Response updateUser(String body, @Context HttpHeaders headers, @Context UriInfo
ui,
                                  @PathParam("userName") String userName) {
 
-     return handleRequest(headers, body, ui, Request.Type.PUT, createUserResource(userName));
-   }
-   
-   /**
-    * Deletes a user.
-    * Handles:  DELETE /users/{userName}
-    */
-   @DELETE
-   @Path("{userName}")
-   @Produces("text/plain")
-   public Response deleteUser(@Context HttpHeaders headers, @Context UriInfo ui,
+    return handleRequest(headers, body, ui, Request.Type.PUT, createUserResource(userName));
+  }
+
+  /**
+   * Deletes a user.
+   * Handles:  DELETE /users/{userName}
+   */
+  @DELETE
+  @Path("{userName}")
+  @Produces("text/plain")
+  public Response deleteUser(@Context HttpHeaders headers, @Context UriInfo ui,
                                  @PathParam("userName") String userName) {
-     return handleRequest(headers, null, ui, Request.Type.DELETE, createUserResource(userName));
-   }
+    return handleRequest(headers, null, ui, Request.Type.DELETE, createUserResource(userName));
+  }
 
   /**
    * Create a user resource instance.

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index e392a71..62146ad 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -659,6 +659,10 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
           }
         }
       }
+
+      if (null != request.isActive() && null != user) {
+        users.setUserActive(user, request.isActive());
+      }
     }
   }
 
@@ -2212,6 +2216,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
         users.addRoleToUser(u, role);
       }
 
+      if (null != request.isActive()) {
+        users.setUserActive(u, request.isActive());
+      }
     }
   }
 
@@ -2512,7 +2519,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       // get them all
       if (null == r.getUsername()) {
         for (User u : users.getAllUsers()) {
-          UserResponse resp = new UserResponse(u.getUserName(), u.isLdapUser());
+          UserResponse resp = new UserResponse(u.getUserName(), u.isLdapUser(), u.isActive());
           resp.setRoles(new HashSet<String>(u.getRoles()));
           responses.add(resp);
         }
@@ -2527,7 +2534,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
                 + r.getUsername() + "'");
           }
         } else {
-          UserResponse resp = new UserResponse(u.getUserName(), u.isLdapUser());
+          UserResponse resp = new UserResponse(u.getUserName(), u.isLdapUser(), u.isActive());
           resp.setRoles(new HashSet<String>(u.getRoles()));
           responses.add(resp);
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
index 3ef8495..bd9a9f9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
@@ -27,6 +27,7 @@ public class UserRequest {
   private String userName;
   private String password;
   private String oldPassword;
+  private Boolean active;
   private Set<String> roles = new HashSet<String>();
 
   public UserRequest(String name) {
@@ -61,6 +62,14 @@ public class UserRequest {
     oldPassword = oldUserPass;
   }
 
+  public Boolean isActive() {
+    return active;
+  }
+
+  public void setActive(Boolean active) {
+    this.active = active;
+  }
+
   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
index 4bf3a48..a5c13d2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
@@ -28,10 +28,12 @@ public class UserResponse {
   private Set<String> roles = Collections.emptySet();
   private final String userName;
   private final boolean isLdapUser;
+  private final boolean isActive;
 
-  public UserResponse(String name, boolean isLdapUser) {
+  public UserResponse(String name, boolean isLdapUser, boolean isActive) {
     this.userName = name;
     this.isLdapUser = isLdapUser;
+    this.isActive = isActive;
   }
 
   public String getUsername() {
@@ -74,4 +76,7 @@ public class UserResponse {
     return isLdapUser;
   }
 
+  public boolean isActive() {
+    return isActive;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
index 17fdcfd..3c0a7cc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
@@ -43,6 +43,7 @@ class UserResourceProvider extends AbstractControllerResourceProvider {
   protected static final String USER_PASSWORD_PROPERTY_ID     = PropertyHelper.getPropertyId("Users",
"password");
   protected static final String USER_OLD_PASSWORD_PROPERTY_ID = PropertyHelper.getPropertyId("Users",
"old_password");
   protected static final String USER_LDAP_USER_PROPERTY_ID    = PropertyHelper.getPropertyId("Users",
"ldap_user");
+  protected static final String USER_ACTIVE_PROPERTY_ID       = PropertyHelper.getPropertyId("Users",
"active");
 
   private static Set<String> pkPropertyIds =
       new HashSet<String>(Arrays.asList(new String[]{
@@ -121,6 +122,9 @@ class UserResourceProvider extends AbstractControllerResourceProvider
{
       setResourceProperty(resource, USER_LDAP_USER_PROPERTY_ID,
           userResponse.isLdapUser(), requestedIds);
 
+      setResourceProperty(resource, USER_ACTIVE_PROPERTY_ID,
+          userResponse.isActive(), requestedIds);
+
       resources.add(resource);
     }
 
@@ -195,6 +199,10 @@ class UserResourceProvider extends AbstractControllerResourceProvider
{
       request.setRoles(roles);
     }
 
+    if (null != properties.get(USER_ACTIVE_PROPERTY_ID)) {
+      request.setActive(Boolean.valueOf(properties.get(USER_ACTIVE_PROPERTY_ID).toString()));
+    }
+
     return request;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
index 14ad304..1d38a4a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
@@ -56,6 +56,9 @@ public class UserEntity {
   @Temporal(value = TemporalType.TIMESTAMP)
   private Date createTime = new Date();
 
+  @Column(name = "active")
+  private Integer active = 1;
+
   @ManyToMany(mappedBy = "userEntities")
   private Set<RoleEntity> roleEntities;
 
@@ -122,6 +125,18 @@ public class UserEntity {
     this.memberEntities = memberEntities;
   }
 
+  public Boolean getActive() {
+    return active == 0 ? Boolean.FALSE : Boolean.TRUE;
+  }
+
+  public void setActive(Boolean active) {
+    if (active == null) {
+      this.active = null;
+    } else {
+      this.active = active ? 1 : 0;
+    }
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;
@@ -134,6 +149,7 @@ public class UserEntity {
     if (ldapUser != null ? !ldapUser.equals(that.ldapUser) : that.ldapUser != null) return
false;
     if (userName != null ? !userName.equals(that.userName) : that.userName != null) return
false;
     if (userPassword != null ? !userPassword.equals(that.userPassword) : that.userPassword
!= null) return false;
+    if (active != null ? !active.equals(that.active) : that.active != null) return false;
 
     return true;
   }
@@ -145,6 +161,7 @@ public class UserEntity {
     result = 31 * result + (userPassword != null ? userPassword.hashCode() : 0);
     result = 31 * result + (ldapUser != null ? ldapUser.hashCode() : 0);
     result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
+    result = 31 * result + (active != null ? active.hashCode() : 0);
     return result;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
index 6693a8a..f9f8e21 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
@@ -32,6 +32,7 @@ public class User {
   final String userName;
   final boolean ldapUser;
   final Date createTime;
+  final boolean active;
   final Collection<String> roles = new ArrayList<String>();
 
   User(UserEntity userEntity) {
@@ -39,6 +40,7 @@ public class User {
     userName = userEntity.getUserName();
     createTime = userEntity.getCreateTime();
     ldapUser = userEntity.getLdapUser();
+    active = userEntity.getActive();
     for (RoleEntity roleEntity : userEntity.getRoleEntities()) {
       roles.add(roleEntity.getRoleName());
     }
@@ -60,6 +62,10 @@ public class User {
     return createTime;
   }
 
+  public boolean isActive() {
+    return active;
+  }
+
   public Collection<String> getRoles() {
     return roles;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
index 072d3de..a94adaf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
@@ -163,6 +163,20 @@ public class Users {
   }
 
   /**
+   * Enables/disables user.
+   * @throws AmbariException
+   */
+  public synchronized void setUserActive(User user, boolean active) throws AmbariException
{
+    UserEntity userEntity = userDAO.findByPK(user.getUserId());
+    if (userEntity != null) {
+      userEntity.setActive(active);
+      userDAO.merge(userEntity);
+    } else {
+      throw new AmbariException("User " + user + " doesn't exist");
+    }
+  }
+
+  /**
    * Creates new local user with provided userName and password
    */
   @Transactional

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index 4821e91..c1bc0cc 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -37,7 +37,7 @@ CREATE TABLE hoststate (agent_version VARCHAR(255) NOT NULL, available_mem
BIGIN
 CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id
BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT
NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 CREATE TABLE servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping INTEGER
NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL, maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE',
PRIMARY KEY (cluster_id, service_name));
 CREATE TABLE roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));
-CREATE TABLE users (user_id INTEGER, create_time TIMESTAMP DEFAULT NOW(), ldap_user INTEGER
NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL, user_password VARCHAR(255), PRIMARY KEY
(user_id));
+CREATE TABLE users (user_id INTEGER, create_time TIMESTAMP DEFAULT NOW(), ldap_user INTEGER
NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL, user_password VARCHAR(255), active INTEGER
NOT NULL DEFAULT 1, PRIMARY KEY (user_id));
 CREATE TABLE groups (group_id INTEGER, group_name VARCHAR(255) NOT NULL, ldap_group INTEGER
NOT NULL DEFAULT 0, PRIMARY KEY (group_id));
 CREATE TABLE members (member_id INTEGER, group_id INTEGER NOT NULL, user_id INTEGER NOT NULL,
PRIMARY KEY (member_id));
 CREATE TABLE execution_command (task_id BIGINT NOT NULL, command LONGBLOB, PRIMARY KEY (task_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index be2477b..fe480d2 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -27,7 +27,7 @@ CREATE TABLE hoststate (agent_version VARCHAR2(255) NULL, available_mem
NUMBER(1
 CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR2(255) NOT NULL, cluster_id
NUMBER(19) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255)
NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
 CREATE TABLE servicedesiredstate (cluster_id NUMBER(19) NOT NULL, desired_host_role_mapping
NUMBER(10) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255)
NOT NULL, service_name VARCHAR2(255) NOT NULL, maintenance_state VARCHAR2(32) NOT NULL, PRIMARY
KEY (cluster_id, service_name));
 CREATE TABLE roles (role_name VARCHAR2(255) NOT NULL, PRIMARY KEY (role_name));
-CREATE TABLE users (user_id NUMBER(10) NOT NULL, create_time TIMESTAMP NULL, ldap_user NUMBER(10)
DEFAULT 0, user_name VARCHAR2(255) NULL, user_password VARCHAR2(255) NULL, PRIMARY KEY (user_id));
+CREATE TABLE users (user_id NUMBER(10) NOT NULL, create_time TIMESTAMP NULL, ldap_user NUMBER(10)
DEFAULT 0, user_name VARCHAR2(255) NULL, user_password VARCHAR2(255) NULL, active INTEGER
NOT NULL DEFAULT 1, PRIMARY KEY (user_id));
 CREATE TABLE groups (group_id NUMBER(10) NOT NULL, group_name VARCHAR2(255) NOT NULL, ldap_group
NUMBER(10) DEFAULT 0, PRIMARY KEY (group_id));
 CREATE TABLE members (member_id NUMBER(10), group_id NUMBER(10) NOT NULL, user_id NUMBER(10)
NOT NULL, PRIMARY KEY (member_id));
 CREATE TABLE execution_command (task_id NUMBER(19) NOT NULL, command BLOB NULL, PRIMARY KEY
(task_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index d964d01..7d3f9c9 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -41,7 +41,7 @@ CREATE TABLE servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_
 
 CREATE TABLE roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));
 
-CREATE TABLE users (user_id INTEGER, ldap_user INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255)
NOT NULL, create_time TIMESTAMP DEFAULT NOW(), user_password VARCHAR(255), PRIMARY KEY (user_id),
UNIQUE (ldap_user, user_name));
+CREATE TABLE users (user_id INTEGER, ldap_user INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255)
NOT NULL, create_time TIMESTAMP DEFAULT NOW(), user_password VARCHAR(255), PRIMARY KEY (user_id),
active INTEGER NOT NULL DEFAULT 1, UNIQUE (ldap_user, user_name));
 
 CREATE TABLE groups (group_id INTEGER, group_name VARCHAR(255) NOT NULL, ldap_group INTEGER
NOT NULL DEFAULT 0, PRIMARY KEY (group_id), UNIQUE (ldap_group, group_name));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index 63f0957..1b95476 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -64,7 +64,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.servicedesiredstate TO :username;
 CREATE TABLE ambari.roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));
 GRANT ALL PRIVILEGES ON TABLE ambari.roles TO :username;
 
-CREATE TABLE ambari.users (user_id INTEGER, ldap_user INTEGER NOT NULL DEFAULT 0, user_name
VARCHAR(255) NOT NULL, create_time TIMESTAMP DEFAULT NOW(), user_password VARCHAR(255), PRIMARY
KEY (user_id), UNIQUE (ldap_user, user_name));
+CREATE TABLE ambari.users (user_id INTEGER, ldap_user INTEGER NOT NULL DEFAULT 0, user_name
VARCHAR(255) NOT NULL, create_time TIMESTAMP DEFAULT NOW(), user_password VARCHAR(255), active
INTEGER NOT NULL DEFAULT 1, PRIMARY KEY (user_id), UNIQUE (ldap_user, user_name));
 GRANT ALL PRIVILEGES ON TABLE ambari.users TO :username;
 
 CREATE TABLE ambari.groups (group_id INTEGER, group_name VARCHAR(255) NOT NULL, ldap_group
INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (group_id), UNIQUE (ldap_group, group_name));

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index 79be0e1..eb364fb 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -160,6 +160,7 @@
         "Users/password",
         "Users/old_password",
         "Users/ldap_user",
+        "Users/active",
         "_"
     ],
     "Group":[

http://git-wip-us.apache.org/repos/asf/ambari/blob/97a5a947/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderTest.java
index cfb2e3f..3c1be40 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderTest.java
@@ -92,7 +92,7 @@ public class UserResourceProviderTest {
     AmbariManagementController managementController = createMock(AmbariManagementController.class);
 
     Set<UserResponse> allResponse = new HashSet<UserResponse>();
-    allResponse.add(new UserResponse("User100", false));
+    allResponse.add(new UserResponse("User100", false, true));
 
     // set expectations
     expect(managementController.getUsers(AbstractResourceProviderTest.Matcher.getUserRequestSet("User100"))).


Mime
View raw message