Admin-Project UI page accessible to users
Make the Admin->Projects page in the UI available to non-admin users. The page will only show projects in which the user has read access. Change-Id: I803609da4631cf037ba8b667ec927d1f9e3f8620
This commit is contained in:

committed by
Shawn O. Pearce

parent
7e6d9808db
commit
702810d11e
@@ -23,6 +23,7 @@ import com.google.gerrit.reviewdb.RefRight;
|
||||
public class InheritedRefRight {
|
||||
private RefRight right;
|
||||
private boolean inherited;
|
||||
private boolean owner;
|
||||
|
||||
/**
|
||||
* Creates a instance of a {@link RefRight} with data about inheritance
|
||||
@@ -35,10 +36,12 @@ public class InheritedRefRight {
|
||||
*
|
||||
* @param right the right
|
||||
* @param inherited true if the right is inherited, false otherwise
|
||||
* @param owner true if right is owned by current user, false otherwise
|
||||
*/
|
||||
public InheritedRefRight(RefRight right, boolean inherited) {
|
||||
public InheritedRefRight(RefRight right, boolean inherited, boolean owner) {
|
||||
this.right = right;
|
||||
this.inherited = inherited;
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public RefRight getRight() {
|
||||
@@ -49,6 +52,10 @@ public class InheritedRefRight {
|
||||
return inherited;
|
||||
}
|
||||
|
||||
public boolean isOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof InheritedRefRight) {
|
||||
|
@@ -0,0 +1,53 @@
|
||||
// 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.Branch;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* It holds list of branches and boolean to indicate
|
||||
* if it is allowed to add new branches.
|
||||
*/
|
||||
public final class ListBranchesResult {
|
||||
protected boolean canAdd;
|
||||
|
||||
protected List<Branch> branches;
|
||||
|
||||
protected ListBranchesResult() {
|
||||
}
|
||||
|
||||
public ListBranchesResult(final List<Branch> branches, boolean canAdd) {
|
||||
this.branches = branches;
|
||||
this.canAdd = canAdd;
|
||||
}
|
||||
|
||||
public boolean getCanAdd() {
|
||||
return canAdd;
|
||||
}
|
||||
|
||||
public void setCanAdd(boolean canAdd) {
|
||||
this.canAdd = canAdd;
|
||||
}
|
||||
|
||||
public List<Branch> getBranches() {
|
||||
return branches;
|
||||
}
|
||||
|
||||
public void setBranches(List<Branch> branches) {
|
||||
this.branches = branches;
|
||||
}
|
||||
}
|
@@ -22,7 +22,6 @@ import com.google.gerrit.reviewdb.RefRight;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwtjsonrpc.client.RemoteJsonService;
|
||||
import com.google.gwtjsonrpc.client.RpcImpl;
|
||||
import com.google.gwtjsonrpc.client.VoidResult;
|
||||
import com.google.gwtjsonrpc.client.RpcImpl.Version;
|
||||
|
||||
import java.util.List;
|
||||
@@ -31,7 +30,7 @@ import java.util.Set;
|
||||
@RpcImpl(version = Version.V2_0)
|
||||
public interface ProjectAdminService extends RemoteJsonService {
|
||||
@SignInRequired
|
||||
void ownedProjects(AsyncCallback<List<Project>> callback);
|
||||
void visibleProjects(AsyncCallback<List<Project>> callback);
|
||||
|
||||
@SignInRequired
|
||||
void projectDetail(Project.NameKey projectName,
|
||||
@@ -43,7 +42,7 @@ public interface ProjectAdminService extends RemoteJsonService {
|
||||
|
||||
@SignInRequired
|
||||
void deleteRight(Project.NameKey projectName, Set<RefRight.Key> ids,
|
||||
AsyncCallback<VoidResult> callback);
|
||||
AsyncCallback<ProjectDetail> callback);
|
||||
|
||||
@SignInRequired
|
||||
void addRight(Project.NameKey projectName, ApprovalCategory.Id categoryId,
|
||||
@@ -52,11 +51,11 @@ public interface ProjectAdminService extends RemoteJsonService {
|
||||
|
||||
@SignInRequired
|
||||
void listBranches(Project.NameKey projectName,
|
||||
AsyncCallback<List<Branch>> callback);
|
||||
AsyncCallback<ListBranchesResult> callback);
|
||||
|
||||
@SignInRequired
|
||||
void addBranch(Project.NameKey projectName, String branchName,
|
||||
String startingRevision, AsyncCallback<List<Branch>> callback);
|
||||
String startingRevision, AsyncCallback<ListBranchesResult> callback);
|
||||
|
||||
@SignInRequired
|
||||
void deleteBranch(Project.NameKey projectName, Set<Branch.NameKey> ids,
|
||||
|
@@ -24,6 +24,10 @@ public class ProjectDetail {
|
||||
public Project project;
|
||||
public Map<AccountGroup.Id, AccountGroup> groups;
|
||||
public List<InheritedRefRight> rights;
|
||||
public boolean canModifyDescription;
|
||||
public boolean canModifyMergeType;
|
||||
public boolean canModifyAgreements;
|
||||
public boolean canModifyAccess;
|
||||
|
||||
public ProjectDetail() {
|
||||
}
|
||||
@@ -39,4 +43,20 @@ public class ProjectDetail {
|
||||
public void setRights(final List<InheritedRefRight> r) {
|
||||
rights = r;
|
||||
}
|
||||
|
||||
public void setCanModifyDescription(final boolean cmd) {
|
||||
canModifyDescription = cmd;
|
||||
}
|
||||
|
||||
public void setCanModifyMergeType(final boolean cmmt) {
|
||||
canModifyMergeType = cmmt;
|
||||
}
|
||||
|
||||
public void setCanModifyAgreements(final boolean cma) {
|
||||
canModifyAgreements = cma;
|
||||
}
|
||||
|
||||
public void setCanModifyAccess(final boolean cma) {
|
||||
canModifyAccess = cma;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user