Inherit project permissions from more than just All Projects

Add the basic functionality to build a tree of projects for easier
administation of access rights.  With this change, any project can
act as a parent project to another.

The way to set a project as a parent of another is done with a
new command: `gerrit set-project-parent`.  Right now there is no
possibility to set or remove the parenthood from the UI.

Bug: issue 273
Change-Id: Iac514de89e24b470339ea53065f8b470de68ab75
Uploaded-by: Ulrik Sjölin <ulrik.sjolin@sonyericsson.com>
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
lincoln
2010-04-22 14:23:05 -03:00
committed by Shawn O. Pearce
parent 072b470570
commit fa7bdd39ed
22 changed files with 457 additions and 59 deletions

View File

@@ -0,0 +1,67 @@
// Copyright (C) 2010 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.common.data;
import com.google.gerrit.reviewdb.RefRight;
/**
* Additional data about a {@link RefRight} not normally loaded: defines if a
* right is inherited from a parent structure (e.g. a parent project).
*/
public class InheritedRefRight {
private RefRight right;
private boolean inherited;
/**
* Creates a instance of a {@link RefRight} with data about inheritance
*/
protected InheritedRefRight() {
}
/**
* Creates a instance of a {@link RefRight} with data about inheritance
*
* @param right the right
* @param inherited true if the right is inherited, false otherwise
*/
public InheritedRefRight(RefRight right, boolean inherited) {
this.right = right;
this.inherited = inherited;
}
public RefRight getRight() {
return right;
}
public boolean isInherited() {
return inherited;
}
@Override
public boolean equals(Object o) {
if (o instanceof InheritedRefRight) {
InheritedRefRight a = this;
InheritedRefRight b = (InheritedRefRight) o;
return a.getRight().equals(b.getRight())
&& a.isInherited() == b.isInherited();
}
return false;
}
@Override
public int hashCode() {
return getRight().hashCode();
}
}

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.common.data;
import com.google.gerrit.reviewdb.AccountGroup;
import com.google.gerrit.reviewdb.Project;
import com.google.gerrit.reviewdb.RefRight;
import java.util.List;
import java.util.Map;
@@ -24,7 +23,7 @@ import java.util.Map;
public class ProjectDetail {
public Project project;
public Map<AccountGroup.Id, AccountGroup> groups;
public List<RefRight> rights;
public List<InheritedRefRight> rights;
public ProjectDetail() {
}
@@ -37,7 +36,7 @@ public class ProjectDetail {
groups = g;
}
public void setRights(final List<RefRight> r) {
public void setRights(final List<InheritedRefRight> r) {
rights = r;
}
}