mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-03 06:28:06 +01:00
fix(robot): make resource with projectId for robot in portal (#8798)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
This commit is contained in:
parent
3ebe81de8f
commit
d6a6101fc2
@ -26,23 +26,23 @@ export class RobotService {
|
|||||||
) { }
|
) { }
|
||||||
|
|
||||||
/** addRobotAccount
|
/** addRobotAccount
|
||||||
* projecId
|
* projectId
|
||||||
* robot: Robot
|
* robot: Robot
|
||||||
* projectName
|
* projectName
|
||||||
*/
|
*/
|
||||||
public addRobotAccount(projecId: number, robot: Robot, projectName: string): Observable<any> {
|
public addRobotAccount(projectId: number, robot: Robot, projectName: string): Observable<any> {
|
||||||
let access = [];
|
let access = [];
|
||||||
if (robot.access.isPullImage) {
|
if (robot.access.isPullImage) {
|
||||||
access.push({ "resource": `/project/${projectName}/repository`, "action": "pull" });
|
access.push({ "resource": `/project/${projectId}/repository`, "action": "pull" });
|
||||||
}
|
}
|
||||||
if (robot.access.isPushOrPullImage) {
|
if (robot.access.isPushOrPullImage) {
|
||||||
access.push({ "resource": `/project/${projectName}/repository`, "action": "push" });
|
access.push({ "resource": `/project/${projectId}/repository`, "action": "push" });
|
||||||
}
|
}
|
||||||
if (robot.access.isPullChart) {
|
if (robot.access.isPullChart) {
|
||||||
access.push({ "resource": `/project/${projectName}/helm-chart`, "action": "read" });
|
access.push({ "resource": `/project/${projectId}/helm-chart`, "action": "read" });
|
||||||
}
|
}
|
||||||
if (robot.access.isPushChart) {
|
if (robot.access.isPushChart) {
|
||||||
access.push({ "resource": `/project/${projectName}/helm-chart-version`, "action": "create" });
|
access.push({ "resource": `/project/${projectId}/helm-chart-version`, "action": "create" });
|
||||||
}
|
}
|
||||||
|
|
||||||
let param = {
|
let param = {
|
||||||
@ -51,25 +51,25 @@ export class RobotService {
|
|||||||
access
|
access
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.robotApiRepository.postRobot(projecId, param);
|
return this.robotApiRepository.postRobot(projectId, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteRobotAccount(projecId, id): Observable<any> {
|
public deleteRobotAccount(projectId, id): Observable<any> {
|
||||||
return this.robotApiRepository.deleteRobot(projecId, id);
|
return this.robotApiRepository.deleteRobot(projectId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public listRobotAccount(projecId): Observable<any> {
|
public listRobotAccount(projectId): Observable<any> {
|
||||||
return this.robotApiRepository.listRobot(projecId);
|
return this.robotApiRepository.listRobot(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRobotAccount(projecId, id): Observable<any> {
|
public getRobotAccount(projectId, id): Observable<any> {
|
||||||
return this.robotApiRepository.getRobot(projecId, id);
|
return this.robotApiRepository.getRobot(projectId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public toggleDisabledAccount(projecId, id, isDisabled): Observable<any> {
|
public toggleDisabledAccount(projectId, id, isDisabled): Observable<any> {
|
||||||
let data = {
|
let data = {
|
||||||
Disabled: isDisabled
|
Disabled: isDisabled
|
||||||
};
|
};
|
||||||
return this.robotApiRepository.toggleDisabledAccount(projecId, id, data);
|
return this.robotApiRepository.toggleDisabledAccount(projectId, id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user