Allow Owner permission to inherit
The Owner permission should be inherited from any parent project, so long as the parent project isn't the global -- All Projects -- parent project. Change-Id: I2a1f1d9c941a44d2ed4b8d900ee3ef6e48368343 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -56,12 +56,22 @@ public class ProjectState {
|
||||
@WildProjectName final Project.NameKey wildProject,
|
||||
final ProjectControl.AssistedFactory projectControlFactory,
|
||||
@Assisted final Project project,
|
||||
@Assisted final Collection<RefRight> rights) {
|
||||
@Assisted Collection<RefRight> rights) {
|
||||
this.anonymousUser = anonymousUser;
|
||||
this.projectCache = projectCache;
|
||||
this.wildProject = wildProject;
|
||||
this.projectControlFactory = projectControlFactory;
|
||||
|
||||
if (wildProject.equals(project.getNameKey())) {
|
||||
rights = new ArrayList<RefRight>(rights);
|
||||
for (Iterator<RefRight> itr = rights.iterator(); itr.hasNext();) {
|
||||
if (!itr.next().getApprovalCategoryId().canBeOnWildProject()) {
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
rights = Collections.unmodifiableCollection(rights);
|
||||
}
|
||||
|
||||
this.project = project;
|
||||
this.localRights = rights;
|
||||
|
||||
@@ -174,9 +184,7 @@ public class ProjectState {
|
||||
*/
|
||||
public Collection<RefRight> getAllRights(ApprovalCategory.Id action, boolean dropOverridden) {
|
||||
Collection<RefRight> rights = new LinkedList<RefRight>(getLocalRights(action));
|
||||
if (action.canInheritFromWildProject()) {
|
||||
rights.addAll(filter(getInheritedRights(), action));
|
||||
}
|
||||
rights.addAll(filter(getInheritedRights(), action));
|
||||
if (dropOverridden) {
|
||||
Set<Grant> grants = new HashSet<Grant>();
|
||||
Iterator<RefRight> iter = rights.iterator();
|
||||
|
||||
Reference in New Issue
Block a user