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": [ "owner_of": [
"GLOBAL_CAPABILITIES", "GLOBAL_CAPABILITIES",
"refs/meta/config", "refs/meta/config",
@@ -275,6 +276,7 @@ The entries in the map are sorted by project name.
"description": "Access inherited by all other projects." "description": "Access inherited by all other projects."
}, },
"local": {}, "local": {},
"is_owner": true,
"owner_of": [ "owner_of": [
"refs/*" "refs/*"
], ],
@@ -360,6 +362,8 @@ link:rest-api-projects.html#project-info[ProjectInfo] entity.
|`local` || |`local` ||
The local access rights of the project as a map that maps the refs to The local access rights of the project as a map that maps the refs to
link:#access-section-info[AccessSectionInfo] entities. 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. |`owner_of` ||The list of refs owned by the calling user.
|`can_upload` |not set if `false`| |`can_upload` |not set if `false`|
Whether the calling user can upload to any ref. 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 String revision;
public ProjectInfo inheritsFrom; public ProjectInfo inheritsFrom;
public Map<String, AccessSectionInfo> local; public Map<String, AccessSectionInfo> local;
public Boolean isOwner;
public Set<String> ownerOf; public Set<String> ownerOf;
public Boolean canUpload; public Boolean canUpload;
public Boolean canAdd; public Boolean canAdd;
@@ -245,6 +246,7 @@ public class ListAccess implements RestReadView<TopLevelResource> {
} }
} }
isOwner = toBoolean(pc.isOwner());
canUpload = toBoolean(pc.isOwner() canUpload = toBoolean(pc.isOwner()
|| (metaConfigControl.isVisible() && metaConfigControl.canUpload())); || (metaConfigControl.isVisible() && metaConfigControl.canUpload()));
canAdd = toBoolean(pc.canAddRefs()); canAdd = toBoolean(pc.canAddRefs());