Include in ProjectAccessInfo whether the calling user is project owner

Change-Id: I1e1c7e887e88cbfd3a9e390c71cb1def3def18e8
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-07-12 13:21:15 +02:00
parent 1284c16374
commit ca192a6836
2 changed files with 6 additions and 0 deletions

View File

@@ -254,6 +254,7 @@ The entries in the map are sorted by project name.
}
}
},
"is_owner": true,
"owner_of": [
"GLOBAL_CAPABILITIES",
"refs/meta/config",
@@ -275,6 +276,7 @@ The entries in the map are sorted by project name.
"description": "Access inherited by all other projects."
},
"local": {},
"is_owner": true,
"owner_of": [
"refs/*"
],
@@ -360,6 +362,8 @@ link:rest-api-projects.html#project-info[ProjectInfo] entity.
|`local` ||
The local access rights of the project as a map that maps the refs to
link:#access-section-info[AccessSectionInfo] entities.
|`is_owner` |not set if `false`|
Whether the calling user owns this project.
|`owner_of` ||The list of refs owned by the calling user.
|`can_upload` |not set if `false`|
Whether the calling user can upload to any ref.

View File

@@ -146,6 +146,7 @@ public class ListAccess implements RestReadView<TopLevelResource> {
public String revision;
public ProjectInfo inheritsFrom;
public Map<String, AccessSectionInfo> local;
public Boolean isOwner;
public Set<String> ownerOf;
public Boolean canUpload;
public Boolean canAdd;
@@ -245,6 +246,7 @@ public class ListAccess implements RestReadView<TopLevelResource> {
}
}
isOwner = toBoolean(pc.isOwner());
canUpload = toBoolean(pc.isOwner()
|| (metaConfigControl.isVisible() && metaConfigControl.canUpload()));
canAdd = toBoolean(pc.canAddRefs());