Juan Hernandez has posted comments on this change.

Change subject: core, restapi: Add DbGroup
......................................................................


Patch Set 8:

(8 comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDirectoryGroupCommand.java
Line 30:     protected boolean canDoAction() {
Line 31:         Guid id = null;
Line 32:         String domain = null;
Line 33:         if (getParameters().getGroup() != null) {
Line 34:             addCustomValue("NewUserName", 
getParameters().getGroup().getname());
I agree that would be a good thing, but this is mostly copied from the 
"AddUserCommand", where it is also a plain string. I prefer to not include this 
in this already long set of patches.
Line 35:             id = getParameters().getGroup().getid();
Line 36:             domain = getParameters().getGroup().getdomain();
Line 37:             LdapGroup adGroup =
Line 38:                     (LdapGroup) 
LdapFactory.getInstance(domain).RunAdAction(AdActionType.GetAdGroupByGroupId,


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachUserGroupToTagCommand.java
Line 22:                     TagsUserGroupMap map = new 
TagsUserGroupMap(groupGuid, getTagId());
Line 23:                     
DbFacade.getInstance().getTagDao().attachUserGroupToTag(map);
Line 24:                     noActionDone = false;
Line 25:                     if (group != null) {
Line 26:                         appendCustomValue("AttachGroupsNames", 
group.getName(), ", ");
I agree that this is good, but as I wrote in another comment I prefer to avoid 
mixing that with this set of patches.
Line 27:                     }
Line 28:                 } else {
Line 29:                     if (group != null) {
Line 30:                         appendCustomValue("AttachGroupsNamesExists", 
group.getName(), ", ");


Line 26:                         appendCustomValue("AttachGroupsNames", 
group.getName(), ", ");
Line 27:                     }
Line 28:                 } else {
Line 29:                     if (group != null) {
Line 30:                         appendCustomValue("AttachGroupsNamesExists", 
group.getName(), ", ");
Same as above.
Line 31:                     }
Line 32:                 }
Line 33:             }
Line 34:             setSucceeded(true);


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DbUserCacheManager.java
Line 242:             /*
Line 243:              * Vitaly workaround. Temporary treatment on missing 
group domains
Line 244:              */
Line 245: 
Line 246:             // Waiting for the GUI team to fix the ad_group class. 
When the
Probably, but not part of this patch.
Line 247:             // class is fixed,
Line 248:             // domain name will be passed correctly to the backend, 
and the
Line 249:             // following code should not occur
Line 250:             if (group.getDomain() == null && 
group.getName().contains("@")) {


Line 280:                                     
.RunAdAction(AdActionType.GetAdGroupByGroupId,
Line 281:                                             new 
LdapSearchByIdParameters(group.getDomain(), group.getId()))
Line 282:                                     .getReturnValue();
Line 283: 
Line 284:                     if (group.getStatus() == 1 // Active
In the next patch set I am renaming this method (and the database column) from 
"status" to "active". It will be a boolean, so this will be easier to read:

  if (group.isActive() ...
Line 285:                                 && (groupFromAD == null || 
groupFromAD.getstatus() == LdapRefStatus.Inactive)) {
Line 286:                         group.setStatus(0); // Inactive
Line 287:                     } else if (groupFromAD != null
Line 288:                                 && 
(!StringUtils.equals(group.getName(), groupFromAD.getname())


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DbGroup.java
Line 22: 
Line 23:     private String domain;
Line 24:     private String name;
Line 25:     private String distinguishedName;
Line 26:     private List<String> memberOf;
A set is conceptually better than a list here. However it is expensive, and the 
places where this method is used already use lists. Anyhow, I am changing to 
set in the next patch set.
Line 27: 
Line 28:     /**
Line 29:      * The status of the user in the directory, 0 for inactive and any 
other
Line 30:      * value for active.


....................................................
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DbGroupDAODbFacadeImpl.java
Line 69:                 .addValue("id", group.getId())
Line 70:                 .addValue("name", group.getName())
Line 71:                 .addValue("status", group.getStatus())
Line 72:                 .addValue("domain", group.getDomain())
Line 73:                 .addValue("distinguishedname", 
group.getDistinguishedName())
Yes, but the table (ad_groups) already exists and this is the current name of 
the column. I think that this columns should be removed, so it isn't worth 
changing the name now.
Line 74:                 .addValue("external_id", group.getExternalId()));
Line 75:     }
Line 76: 
Line 77:     @Override


....................................................
File 
backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/ADSyntaxChecker.java
Line 280:     private static String 
generateAdQueryFromSyntaxContainer(SyntaxContainer syntax) {
Line 281:         StringBuilder retval = new StringBuilder();
Line 282:         if (syntax.getvalid()) {
Line 283:             IConditionFieldAutoCompleter conditionFieldAC;
Line 284:             final boolean isUsersQuery = 
syntax.getSearchObjectStr().contains("ADUSER");
This "ADUSER" string (and also "ADGROUP") are used as keys to identify queries 
that request directory users/groups instead of database users/groups. I agree 
that the "AD" prefix shouldn't be in the code, but I prefer to do that later, 
to not overcomplicate these changes.
Line 285:             if (isUsersQuery) {
Line 286:                 retval.append("(&");
Line 287:                 retval.append("(" + USER_ACCOUNT_TYPE + ")");
Line 288:                 conditionFieldAC = new 
AdUserConditionFieldAutoCompleter();


-- 
To view, visit http://gerrit.ovirt.org/17544
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Idb1a7146c29eb74f97e10043d65b5a67f1430021
Gerrit-PatchSet: 8
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Liran Zelkha <[email protected]>
Gerrit-Reviewer: Martin PeÅ™ina <[email protected]>
Gerrit-Reviewer: Oved Ourfali <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: mooli tayer <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to