Expose two methods in ProjectControl: isReadable and isHidden
The isVisible method is not sufficient for replication purposes where I would like to introduce replicateHiddenProjects flag to control the replication of hidden projects. We do not want to replicate projects that the user has no access to, but with isVisible method we have no possibility to distinguish between projects that are not readable to a user and readable but hidden. For this reason two methods are exposed: isHidden reports whether the project is hidden isReadable tells if the project is readable Change-Id: I1e5e773db6ea1ab9ff95ad8f34155057cf6bf14d
This commit is contained in:
committed by
Sebastian Schuberth
parent
b5a7399239
commit
4db5da7b4e
@@ -272,15 +272,27 @@ public class ProjectControl {
|
||||
return labelTypes;
|
||||
}
|
||||
|
||||
private boolean isHidden() {
|
||||
/** Returns whether the project is hidden. */
|
||||
public boolean isHidden() {
|
||||
return getProject().getState().equals(
|
||||
com.google.gerrit.extensions.client.ProjectState.HIDDEN);
|
||||
}
|
||||
|
||||
/** Can this user see this project exists? */
|
||||
public boolean isVisible() {
|
||||
/**
|
||||
* Returns whether the project is readable to the current user. Note
|
||||
* that the project could still be hidden.
|
||||
*/
|
||||
public boolean isReadable() {
|
||||
return (user.isInternalUser()
|
||||
|| canPerformOnAnyRef(Permission.READ)) && !isHidden();
|
||||
|| canPerformOnAnyRef(Permission.READ));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the project is accessible to the current user, i.e.
|
||||
* readable and not hidden.
|
||||
*/
|
||||
public boolean isVisible() {
|
||||
return isReadable() && !isHidden();
|
||||
}
|
||||
|
||||
public boolean canAddRefs() {
|
||||
|
||||
Reference in New Issue
Block a user