Juan Hernandez has posted comments on this change.
Change subject: core, restapi: Add DbGroup
......................................................................
Patch Set 9:
(8 comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDirectoryGroupCommand.java
Line 15: import org.ovirt.engine.core.compat.Guid;
Line 16:
Line 17: public class AddDirectoryGroupCommand<T extends
AddDirectoryGroupParameters>
Line 18: extends CommandBase<T> {
Line 19:
In the RESTAPI, in the BackendGroupsResource resource also added in this patch.
Line 20: public AddDirectoryGroupCommand(T params) {
Line 21: super(params);
Line 22: }
Line 23:
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DbUserCacheManager.java
Line 164: List<String> domainsList =
LdapBrokerUtils.getDomainsList(true);
Line 165: List<DbUser> filteredUsers = LinqUtils.filter(allUsers,
new UsersPerDomainPredicate(domainsList));
Line 166: Map<String, Map<Guid, DbUser>> userByDomains = new
HashMap<String, Map<Guid, DbUser>>();
Line 167:
Line 168: // Filter all users by domains
I will update the comment, but I don't feel brave enough to improve this class
now.
Line 169: for (DbUser user : filteredUsers) {
Line 170: Map<Guid, DbUser> domainUser;
Line 171: if (!userByDomains.containsKey(user.getDomain())) {
Line 172: domainUser = new HashMap<Guid, DbUser>();
Line 266: // We check if the domain is null or empty for internal
groups.
Line 267: // An internal group does not have a domain, and there is
no need to query
Line 268: // the ldap server for it. Note that if we will add
support in the future for
Line 269: // domain-less groups in the ldap server then this code
will have to change in order
Line 270: // to fetch for them
I am not sure about this, so to be on the safe side I try to preserve the
previous behaviour.
Line 271: if (group.getDomain() != null &&
!group.getDomain().isEmpty()) {
Line 272: if
(UsersDomainsCacheManagerService.getInstance().getDomain(group.getDomain()) ==
null) {
Line 273: log.errorFormat("Cannot query for group {0} from
domain {1} because the domain is not configured. Please use the manage domains
utility if you wish to add this domain.",
Line 274: group.getName(),
Line 282: .getReturnValue();
Line 283:
Line 284: if (group.getStatus() == 1 // Active
Line 285: && (groupFromAD == null ||
groupFromAD.getstatus() == LdapRefStatus.Inactive)) {
Line 286: group.setStatus(0); // Inactive
This is what we used to do. Do you suggest to remove it?
Line 287: } else if (groupFromAD != null
Line 288: &&
(!StringUtils.equals(group.getName(), groupFromAD.getname())
Line 289: || group.getStatus() !=
groupFromAD.getstatus().getValue()
Line 290: ||
!StringUtils.equals(group.getDistinguishedName(),
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/adbroker/LdapBrokerCommandBase.java
Line 152: }
Line 153: for (String groupDN : groupDNList) {
Line 154: String groupName =
LdapBrokerUtils.generateGroupDisplayValue(groupDN);
Line 155: if (!groupsDict.containsKey(groupName)) {
Line 156: DbGroup dbGroup =
DbFacade.getInstance().getDbGroupDao().getByName(groupName);
The group name stored in the database and generated by
LdapBrokerUtils.generateGroupDisplayValue() is something like
"fedora.example.com/Groups/Group0", which includes the domain name, so it is
unique. This is probably something to change in the future, as we are using the
"display name" for internal search, which seems wrong. But I prefer to keep
that out of this patch.
Line 157: LdapGroup ldapGroup = null;
Line 158: if (dbGroup == null) {
Line 159: ldapGroup = new LdapGroup();
Line 160: ldapGroup.setname(groupName);
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DbGroup.java
Line 9: public class DbGroup extends IVdcQueryable {
Line 10: private static final long serialVersionUID = 6717840754119287059L;
Line 11:
Line 12: /**
Line 13: * This is the identifier assigned by the engine to this user for
internal
Done
Line 14: * use only.
Line 15: */
Line 16: private Guid id;
Line 17:
Line 15: */
Line 16: private Guid id;
Line 17:
Line 18: /**
Line 19: * This is the identifier assigned by the external directory to
this user.
Done
Line 20: */
Line 21: private ExternalId externalId;
Line 22:
Line 23: private String domain;
....................................................
File packaging/dbscripts/ad_groups_sp.sql
Line 6:
Line 7:
Line 8:
Line 9:
Line 10: Create or replace FUNCTION InsertGroup(v_id UUID,
It is my understanding that the "refreshStoredProcedures.sh" runs before
creating the new functions, and it calls the "drop_sps" function which removes
all the stored procedures. So the net effect is that only the new procedure
will exist. I may be wrong.
Line 11: v_name VARCHAR(255),
Line 12: v_status INTEGER,
Line 13: v_domain VARCHAR(100),
Line 14: v_distinguishedname VARCHAR(4000),
--
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: 9
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