Allow plugins to reference groups in project config
Groups should be recognized in the plugin section of project configuration. They shall be referenced as a string containing both the group name and uuid. The format to use shall be "Group[name / uuid]", which is the string representation of a GroupReference. Using this format will allow groups referenced in plugin configs to be updated when a group is renamed. It will also validate that the group exists in the groups file. This format does not follow the standard "name = group group_name". Project config must know about both the group name and uuid in order to update the name and reload the config without errors. To rename a group, the groups file [1] for each project is parsed for the uuid. If it is found, the name is updated in the file. Groups are loaded by getting the list of GroupReferences for a section and grabbing the name from the file by uuid. Utilizing GroupReferences allows project config to display the group name without the uuid. However, plugin config entries do not support GroupReferences. This is why the string representation of this object is used. [1] Documentation/config-project-config.html#file-groups Change-Id: I1160f1f55df07243faf0034989ecbbd02a9ca19c
This commit is contained in:
committed by
Marco Miller
parent
1912561ec1
commit
e5a9d01abb
@@ -27,6 +27,14 @@ public class GroupReference implements Comparable<GroupReference> {
|
||||
return new GroupReference(group.getGroupUUID(), group.getName());
|
||||
}
|
||||
|
||||
public static GroupReference fromString(String ref) {
|
||||
String name =
|
||||
ref.substring(ref.indexOf("[") + 1, ref.lastIndexOf("/")).trim();
|
||||
String uuid =
|
||||
ref.substring(ref.lastIndexOf("/") + 1, ref.lastIndexOf("]")).trim();
|
||||
return new GroupReference(new AccountGroup.UUID(uuid), name);
|
||||
}
|
||||
|
||||
protected String uuid;
|
||||
protected String name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user