Use AccountGroup.UUID instead of Account.Id

By switching to the UUID we can have a globally unique identifier
for group membership throughout the server, even if group information
comes in from a different data source.

Change-Id: Icb49d6a6aff8e62864ac0f78ceedbe03f01de894
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-12-21 12:33:12 -08:00
parent bcc191c020
commit e662fb3d4d
49 changed files with 374 additions and 229 deletions

View File

@@ -310,10 +310,10 @@ public class ConfigUtil {
* @return the actual groups resolved from the database. If no groups are
* found, returns an empty {@code Set}, never {@code null}.
*/
public static Set<AccountGroup.Id> groupsFor(
public static Set<AccountGroup.UUID> groupsFor(
SchemaFactory<ReviewDb> dbfactory, String[] groupNames, Logger log,
String groupNotFoundWarning) {
final Set<AccountGroup.Id> result = new HashSet<AccountGroup.Id>();
final Set<AccountGroup.UUID> result = new HashSet<AccountGroup.UUID>();
try {
final ReviewDb db = dbfactory.open();
try {
@@ -322,9 +322,16 @@ public class ConfigUtil {
db.accountGroupNames().get(new AccountGroup.NameKey(name));
if (group == null) {
log.warn(MessageFormat.format(groupNotFoundWarning, name));
} else {
result.add(group.getId());
continue;
}
AccountGroup ag = db.accountGroups().get(group.getId());
if (ag == null) {
log.warn(MessageFormat.format(groupNotFoundWarning, name));
continue;
}
result.add(ag.getGroupUUID());
}
} finally {
db.close();
@@ -345,7 +352,7 @@ public class ConfigUtil {
* @return the actual groups resolved from the database. If no groups are
* found, returns an empty {@code Set}, never {@code null}.
*/
public static Set<AccountGroup.Id> groupsFor(
public static Set<AccountGroup.UUID> groupsFor(
SchemaFactory<ReviewDb> dbfactory, String[] groupNames, Logger log) {
return groupsFor(dbfactory, groupNames, log,
"Group \"{0}\" not in database, skipping.");