Yair Zaslavsky has uploaded a new change for review. Change subject: aaa: Remove "active" from groups ......................................................................
aaa: Remove "active" from groups Change-Id: Id12a172273228609715c7d09c4d173a83478c82c Topic: AAA Signed-off-by: Yair Zaslavsky <yzasl...@redhat.com> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/DbGroup.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/LdapGroup.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DbGroupDAODbFacadeImpl.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbGroupDAOTest.java M backend/manager/modules/dal/src/test/resources/fixtures.xml M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserListModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/user/SubTabUserGeneralView.java M packaging/dbscripts/ad_groups_sp.sql M packaging/dbscripts/create_views.sql 9 files changed, 21 insertions(+), 66 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/20/31520/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/DbGroup.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/DbGroup.java index 05650ed..76d4425 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/DbGroup.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/DbGroup.java @@ -26,12 +26,6 @@ private String distinguishedName; private Set<String> memberOf; - /** - * This flag indicates if the user was available in the directory the last time that it was checked, so {@code true} - * means it was available and {@code false} means it wasn't. - */ - private boolean active; - public DbGroup() { memberOf = new HashSet<String>(); } @@ -84,14 +78,6 @@ name = value; } - public boolean isActive() { - return active; - } - - public void setActive(boolean value) { - active = value; - } - public void setDistinguishedName(String distinguishedName) { this.distinguishedName = distinguishedName; } @@ -124,7 +110,6 @@ result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((distinguishedName == null) ? 0 : distinguishedName.hashCode()); result = prime * result + ((memberOf == null) ? 0 : memberOf.hashCode()); - result = prime * result + (active ? 1231 : 1237); return result; } @@ -145,7 +130,6 @@ && ObjectUtils.objectsEqual(domain, other.domain) && ObjectUtils.objectsEqual(name, other.name) && ObjectUtils.objectsEqual(distinguishedName, other.distinguishedName) - && ObjectUtils.objectsEqual(memberOf, other.memberOf) - && active == other.active); + && ObjectUtils.objectsEqual(memberOf, other.memberOf)); } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/LdapGroup.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/LdapGroup.java index 21d63fc..9d1538a 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/LdapGroup.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/aaa/LdapGroup.java @@ -13,8 +13,6 @@ private String name; - private boolean active; - private String domain; private List<String> memberOf; @@ -22,7 +20,6 @@ private String distinguishedName; public LdapGroup() { - active = true; name = ""; distinguishedName = ""; } @@ -31,7 +28,6 @@ id = dbGroup.getExternalId(); name = dbGroup.getName(); domain = dbGroup.getDomain(); - active = dbGroup.isActive(); distinguishedName = dbGroup.getDistinguishedName(); memberOf = dbGroup.getMemberOf() != null ? new ArrayList<String>(dbGroup.getMemberOf()) : null; } @@ -52,14 +48,6 @@ this.name = value; } - public boolean isActive() { - return active; - } - - public void setActive(boolean value) { - active = value; - } - public LdapGroup(String id, String name, String domain) { this (id); this.name = name; @@ -72,14 +60,8 @@ this.setMemberOf(memberOf); } - /** - * This constructor used only for Inactive groups - * - * @param id - */ public LdapGroup(String id) { this.id = id; - active = false; } public String getdomain() { @@ -120,7 +102,6 @@ result = prime * result + ((domain == null) ? 0 : domain.hashCode()); result = prime * result + ((memberOf == null) ? 0 : memberOf.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + (active ? 1231 : 1237); return result; } @@ -140,7 +121,6 @@ && ObjectUtils.objectsEqual(distinguishedName, other.distinguishedName) && ObjectUtils.objectsEqual(domain, other.domain) && ObjectUtils.objectsEqual(memberOf, other.memberOf) - && ObjectUtils.objectsEqual(name, other.name) - && active == other.active); + && ObjectUtils.objectsEqual(name, other.name)); } } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DbGroupDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DbGroupDAODbFacadeImpl.java index 2aa6672..be30cf8 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DbGroupDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DbGroupDAODbFacadeImpl.java @@ -101,7 +101,6 @@ getCallsHandler().executeModification(storedProcName, getCustomMapSqlParameterSource() .addValue("id", group.getId()) .addValue("name", group.getName()) - .addValue("active", group.isActive()) .addValue("domain", group.getDomain()) .addValue("distinguishedname", group.getDistinguishedName()) .addValue("external_id", group.getExternalId()) @@ -124,7 +123,6 @@ DbGroup entity = new DbGroup(); entity.setId(getGuidDefaultEmpty(rs, "id")); entity.setName(rs.getString("name")); - entity.setActive(rs.getBoolean("active")); entity.setDomain(rs.getString("domain")); entity.setDistinguishedName(rs.getString("distinguishedname")); entity.setExternalId(rs.getString("external_id")); diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbGroupDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbGroupDAOTest.java index 4a9c2ec..31c3602 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbGroupDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbGroupDAOTest.java @@ -33,7 +33,6 @@ newGroup.setExternalId("0"); newGroup.setDomain("domain"); newGroup.setName("name"); - newGroup.setActive(true); newGroup.setNamespace("*"); existingGroup = dao.get(new Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1")); } @@ -139,8 +138,6 @@ public void testUpdate() { existingGroup.setName(existingGroup.getName().toUpperCase()); existingGroup.setDomain(existingGroup.getDomain().toUpperCase()); - existingGroup.setActive(false); - dao.update(existingGroup); DbGroup result = dao.get(existingGroup.getId()); diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index 8de6a8e..97effd1 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -446,13 +446,11 @@ <column>id</column> <column>external_id</column> <column>name</column> - <column>active</column> <column>domain</column> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d1</value> <value>a</value> <value>administrators</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> @@ -460,7 +458,6 @@ <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d2</value> <value>b</value> <value>qa-membersgr...@testportal.redhat.com/test-all-users</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> @@ -468,7 +465,6 @@ <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d3</value> <value>c</value> <value>qb-membersgr...@testportal.redhat.com/test-all-users</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> @@ -476,7 +472,6 @@ <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d4</value> <value>d</value> <value>qc-membersgr...@testportal.redhat.com/test-all-users</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> @@ -484,7 +479,6 @@ <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d5</value> <value>e</value> <value>qd-membersgr...@testportal.redhat.com/test-all-users</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> @@ -492,7 +486,6 @@ <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d6</value> <value>f</value> <value>qe-membersgr...@testportal.redhat.com/test-all-users</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> @@ -500,7 +493,6 @@ <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d7</value> <value>g</value> <value>qf-membersgr...@testportal.redhat.com/test-all-users</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> @@ -508,7 +500,6 @@ <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d8</value> <value>h</value> <value>qg-membersgr...@testportal.redhat.com/test-all-users</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> @@ -516,7 +507,6 @@ <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d9</value> <value>i</value> <value>qh-membersgr...@testportal.redhat.com/test-all-users</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> @@ -524,7 +514,6 @@ <value>9bf7c640-b620-456f-a550-0348f366544b</value> <value>j</value> <value>philosophers</value> - <value>true</value> <value>rhel</value> <value>*</value> </row> diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserListModel.java index 4389bd6..0853a4f 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserListModel.java @@ -469,7 +469,6 @@ grp.setNamespace(item.getNamespace()); grp.setId(item.getId()); grp.setDomain(item.getDomain()); - grp.setActive(item.isActive()); parameters = new AddGroupParameters(grp); } else diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/user/SubTabUserGeneralView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/user/SubTabUserGeneralView.java index 8501b4a..2cc3877 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/user/SubTabUserGeneralView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/user/SubTabUserGeneralView.java @@ -58,18 +58,28 @@ formBuilder = new FormBuilder(formPanel, 1, 3); formBuilder.addFormItem(new FormItem(constants.domainUserGeneral(), domain, 0, 0)); - formBuilder.addFormItem(new FormItem(constants.activeUserGeneral(), active, 1, 0)); + formBuilder.addFormItem(new FormItem(constants.activeUserGeneral(), active, 1, 0) { + @Override + public boolean getIsAvailable() { + return isUserElement(getDetailModel()); + } + }); formBuilder.addFormItem(new FormItem(constants.emailUserGeneral(), email, 2, 0) { @Override public boolean getIsAvailable() { - if (getDetailModel().getEntity() == null) { - return false; - } - return !((DbUser) getDetailModel().getEntity()).isGroup(); + return isUserElement(getDetailModel()); } }); } + private boolean isUserElement(UserGeneralModel userGeneralModel) { + if (getDetailModel().getEntity() == null) { + return false; + } + return !((DbUser) getDetailModel().getEntity()).isGroup(); + + } + @Override public void setMainTabSelectedItem(DbUser selectedItem) { driver.edit(getDetailModel()); diff --git a/packaging/dbscripts/ad_groups_sp.sql b/packaging/dbscripts/ad_groups_sp.sql index a81188d..4ccca21 100644 --- a/packaging/dbscripts/ad_groups_sp.sql +++ b/packaging/dbscripts/ad_groups_sp.sql @@ -9,7 +9,6 @@ Create or replace FUNCTION InsertGroup(v_id UUID, v_name VARCHAR(255), - v_active BOOLEAN, v_domain VARCHAR(100), v_distinguishedname VARCHAR(4000), v_external_id TEXT, @@ -17,8 +16,8 @@ RETURNS VOID AS $procedure$ BEGIN -INSERT INTO ad_groups(id, name,active,domain,distinguishedname,external_id, namespace) - VALUES(v_id, v_name,v_active,v_domain,v_distinguishedname,v_external_id, v_namespace); +INSERT INTO ad_groups(id, name,domain,distinguishedname,external_id, namespace) + VALUES(v_id, v_name,v_domain,v_distinguishedname,v_external_id, v_namespace); END; $procedure$ LANGUAGE plpgsql; @@ -28,7 +27,6 @@ Create or replace FUNCTION UpdateGroup(v_id UUID, v_name VARCHAR(255), - v_active BOOLEAN, v_domain VARCHAR(100), v_distinguishedname VARCHAR(4000), v_external_id TEXT, @@ -39,7 +37,7 @@ AS $procedure$ BEGIN UPDATE ad_groups - SET name = v_name,active = v_active,domain = v_domain,distinguishedname = v_distinguishedname,external_id = v_external_id, namespace = v_namespace + SET name = v_name,domain = v_domain,distinguishedname = v_distinguishedname,external_id = v_external_id, namespace = v_namespace WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; diff --git a/packaging/dbscripts/create_views.sql b/packaging/dbscripts/create_views.sql index 007d483..ed65306 100644 --- a/packaging/dbscripts/create_views.sql +++ b/packaging/dbscripts/create_views.sql @@ -846,7 +846,7 @@ FROM users AS users_1 UNION SELECT 'group' as user_group, ad_groups.name as name, ad_groups.id as id, '' as surname, ad_groups.domain as domain, '' as username, '' as groups, '' as department, '' as role, - '' as email, '' as note, ad_groups.active as active, 1 as vm_admin, null as last_admin_check_status, '' as group_ids, + '' as email, '' as note, true as active, 1 as vm_admin, null as last_admin_check_status, '' as group_ids, ad_groups.external_id as external_id, ad_groups.namespace as namespace FROM ad_groups; -- To view, visit http://gerrit.ovirt.org/31520 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id12a172273228609715c7d09c4d173a83478c82c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches