mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-08 07:05:12 +00:00
fix(console): general fixes, project grants for owned and granted context (#425)
* update and delete project grants * fix: user grant id (#421) * fix: verboser logging on sql err (#412) * fix(eventstore): improve insert statement * fix: verbose logging on error * fix: simplify insertEvents * fix: project grant delete (#417) * fix: add grant id to user grant if needed * fix: add grant id to user grant if needed Co-authored-by: Silvan <[email protected]> * fix user grant context * lint * role validators * fix: usergrantid (#424) * fix: verboser logging on sql err (#412) * fix(eventstore): improve insert statement * fix: verbose logging on error * fix: simplify insertEvents * fix: project grant delete (#417) * fix: add grant id to user grant if needed * fix: add grant id to user grant if needed * fix: add bulk remove * fix: merge Co-authored-by: Silvan <[email protected]> Co-authored-by: Fabi <[email protected]> Co-authored-by: Silvan <[email protected]>
This commit is contained in:
co-authored by
Silvan
Fabi
parent
cf51bbc36d
commit
0b012f2fa2
@@ -21,6 +21,7 @@ import {
|
||||
ProjectGrantUserGrantUpdate,
|
||||
ProjectRoleAdd,
|
||||
ProjectUserGrantSearchRequest,
|
||||
ProjectUserGrantUpdate,
|
||||
SetPasswordNotificationRequest,
|
||||
UpdateUserAddressRequest,
|
||||
UpdateUserEmailRequest,
|
||||
@@ -36,7 +37,6 @@ import {
|
||||
UserGrantSearchQuery,
|
||||
UserGrantSearchRequest,
|
||||
UserGrantSearchResponse,
|
||||
UserGrantUpdate,
|
||||
UserGrantView,
|
||||
UserID,
|
||||
UserPhone,
|
||||
@@ -217,22 +217,22 @@ export class MgmtUserService {
|
||||
);
|
||||
}
|
||||
|
||||
public async CreateUserGrant(
|
||||
projectId: string,
|
||||
userId: string,
|
||||
roleNamesList: string[],
|
||||
): Promise<UserGrant> {
|
||||
const req = new UserGrantCreate();
|
||||
req.setProjectId(projectId);
|
||||
req.setUserId(userId);
|
||||
req.setRoleKeysList(roleNamesList);
|
||||
// public async CreateUserGrant(
|
||||
// projectId: string,
|
||||
// userId: string,
|
||||
// roleNamesList: string[],
|
||||
// ): Promise<UserGrant> {
|
||||
// const req = new UserGrantCreate();
|
||||
// req.setProjectId(projectId);
|
||||
// req.setUserId(userId);
|
||||
// req.setRoleKeysList(roleNamesList);
|
||||
|
||||
return await this.request(
|
||||
c => c.createUserGrant,
|
||||
req,
|
||||
f => f,
|
||||
);
|
||||
}
|
||||
// return await this.request(
|
||||
// c => c.createUserGrant,
|
||||
// req,
|
||||
// f => f,
|
||||
// );
|
||||
// }
|
||||
|
||||
public async CreateProjectUserGrant(
|
||||
projectId: string,
|
||||
@@ -497,18 +497,37 @@ export class MgmtUserService {
|
||||
);
|
||||
}
|
||||
|
||||
public async UpdateUserGrant(
|
||||
// public async UpdateUserGrant(
|
||||
// id: string,
|
||||
// userId: string,
|
||||
// roleKeysList: string[],
|
||||
// ): Promise<UserGrant> {
|
||||
// const req = new UserGrantUpdate();
|
||||
// req.setId(id);
|
||||
// req.setRoleKeysList(roleKeysList);
|
||||
// req.setUserId(userId);
|
||||
|
||||
// return await this.request(
|
||||
// c => c.updateUserGrant,
|
||||
// req,
|
||||
// f => f,
|
||||
// );
|
||||
// }
|
||||
|
||||
public async UpdateProjectUserGrant(
|
||||
id: string,
|
||||
projectId: string,
|
||||
userId: string,
|
||||
roleKeysList: string[],
|
||||
): Promise<UserGrant> {
|
||||
const req = new UserGrantUpdate();
|
||||
const req = new ProjectUserGrantUpdate();
|
||||
req.setId(id);
|
||||
req.setProjectId(projectId);
|
||||
req.setRoleKeysList(roleKeysList);
|
||||
req.setUserId(userId);
|
||||
|
||||
return await this.request(
|
||||
c => c.updateUserGrant,
|
||||
c => c.updateProjectUserGrant,
|
||||
req,
|
||||
f => f,
|
||||
);
|
||||
@@ -516,15 +535,15 @@ export class MgmtUserService {
|
||||
|
||||
public async updateProjectGrantUserGrant(
|
||||
id: string,
|
||||
roleKeysList: string[],
|
||||
userId: string,
|
||||
projectGrantId: string,
|
||||
userId: string,
|
||||
roleKeysList: string[],
|
||||
): Promise<UserGrant> {
|
||||
const req = new ProjectGrantUserGrantUpdate();
|
||||
req.setId(id);
|
||||
req.setProjectGrantId(projectGrantId);
|
||||
req.setRoleKeysList(roleKeysList);
|
||||
req.setUserId(userId);
|
||||
req.setProjectGrantId(projectGrantId);
|
||||
|
||||
return await this.request(
|
||||
c => c.updateProjectGrantUserGrant,
|
||||
|
||||
@@ -165,6 +165,17 @@ export class ProjectService {
|
||||
);
|
||||
}
|
||||
|
||||
public async RemoveProjectGrant(id: string, projectId: string): Promise<Empty> {
|
||||
const req = new ProjectGrantID();
|
||||
req.setId(id);
|
||||
req.setProjectId(projectId);
|
||||
return await this.request(
|
||||
c => c.removeProjectGrant,
|
||||
req,
|
||||
f => f,
|
||||
);
|
||||
}
|
||||
|
||||
public async DeactivateProject(projectId: string): Promise<Project> {
|
||||
const req = new ProjectID();
|
||||
req.setId(projectId);
|
||||
@@ -491,8 +502,10 @@ export class ProjectService {
|
||||
);
|
||||
}
|
||||
|
||||
public async ProjectGrantByID(id: string): Promise<ProjectGrant> {
|
||||
public async ProjectGrantByID(id: string, projectId: string): Promise<ProjectGrantView> {
|
||||
const req = new ProjectGrantID();
|
||||
req.setId(id);
|
||||
req.setProjectId(projectId);
|
||||
return await this.request(
|
||||
c => c.projectGrantByID,
|
||||
req,
|
||||
|
||||
Reference in New Issue
Block a user