You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/11/12 14:26:57 UTC
ambari git commit: AMBARI-13853. UI should not use ldap_user field
after introducing user_type one.
Repository: ambari
Updated Branches:
refs/heads/trunk 77e402ef7 -> bffa4d368
AMBARI-13853. UI should not use ldap_user field after introducing user_type one.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bffa4d36
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bffa4d36
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bffa4d36
Branch: refs/heads/trunk
Commit: bffa4d3688b1ff537871f0b9915cd2e8d227460d
Parents: 77e402e
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Nov 12 15:07:10 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Nov 12 15:26:52 2015 +0200
----------------------------------------------------------------------
ambari-web/app/mappers/users_mapper.js | 4 ++--
ambari-web/app/models/user.js | 18 +++++++++---------
ambari-web/test/models/user_test.js | 15 +++++++--------
3 files changed, 18 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bffa4d36/ambari-web/app/mappers/users_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/users_mapper.js b/ambari-web/app/mappers/users_mapper.js
index 255de7b..cdc8022 100644
--- a/ambari-web/app/mappers/users_mapper.js
+++ b/ambari-web/app/mappers/users_mapper.js
@@ -23,10 +23,10 @@ App.usersMapper = App.QuickDataMapper.create({
config : {
id : 'Users.user_name',
user_name : 'Users.user_name',
- is_ldap: 'Users.ldap_user',
admin: 'Users.admin',
operator: 'Users.operator',
- permissions: 'permissions'
+ permissions: 'permissions',
+ user_type: 'Users.user_type'
},
map: function (json) {
var self = this;
http://git-wip-us.apache.org/repos/asf/ambari/blob/bffa4d36/ambari-web/app/models/user.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/user.js b/ambari-web/app/models/user.js
index c7ca9fe..8e73bcb 100644
--- a/ambari-web/app/models/user.js
+++ b/ambari-web/app/models/user.js
@@ -24,13 +24,7 @@ App.User = DS.Model.extend({
id:function(){
return this.get('userName');
}.property('userName'),
- isLdap:DS.attr('boolean'),
- type: function(){
- if(this.get('isLdap')){
- return 'LDAP';
- }
- return 'Local';
- }.property('isLdap'),
+ userType: DS.attr('string'),
auditItems:DS.hasMany('App.ServiceAudit'),
admin: DS.attr('boolean'),
operator: DS.attr('boolean'),
@@ -43,7 +37,14 @@ App.User = DS.Model.extend({
* VIEW.USE
* @property {Array} permissions
**/
- permissions: DS.attr('array')
+ permissions: DS.attr('array'),
+
+ /**
+ * @type {Boolean}
+ */
+ isLdap: function() {
+ return this.get('userType') === 'LDAP';
+ }.property('userType')
});
App.EditUserForm = App.Form.extend({
@@ -78,7 +79,6 @@ App.EditUserForm = App.Form.extend({
isValid:function () {
var isValid = this._super();
- var thisForm = this;
var newPass = this.get('field.new_password');
var oldPass = this.get('field.old_password');
http://git-wip-us.apache.org/repos/asf/ambari/blob/bffa4d36/ambari-web/test/models/user_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/user_test.js b/ambari-web/test/models/user_test.js
index 8084163..77598b1 100644
--- a/ambari-web/test/models/user_test.js
+++ b/ambari-web/test/models/user_test.js
@@ -49,17 +49,16 @@ describe('App.User', function () {
});
});
- describe('#type', function () {
- it('should be LDAP', function () {
- user.set('isLdap', true);
- expect(user.get('type')).to.equal('LDAP');
+ describe('#isLdap', function() {
+ it('User userType value is "LDAP" should return "true"', function() {
+ user.set('userType', 'LDAP');
+ expect(user.get('isLdap')).to.be.true;
});
- it('should be Local', function () {
- user.set('isLdap', false);
- expect(user.get('type')).to.equal('Local');
+ it('User userType value is "LOCAL" should return "false"', function() {
+ user.set('userType', 'LOCAL');
+ expect(user.get('isLdap')).to.be.false;
});
});
-
});
describe('App.EditUserForm', function () {