33 lines
972 B
TypeScript
33 lines
972 B
TypeScript
import type { ZitaldelClient } from './classes.zitadelclient.js';
|
|
import { ZitadelProjectRole } from './classes.zitadelprojectrole.js';
|
|
import * as plugins from './plugins.js';
|
|
|
|
export class IZitadelProjectData {
|
|
id: string;
|
|
name: string;
|
|
}
|
|
|
|
export class ZitadelProject {
|
|
ziadelclientRef: ZitaldelClient;
|
|
public data: IZitadelProjectData;
|
|
|
|
constructor(zitadelclientRefArg: ZitaldelClient, dataArg: IZitadelProjectData) {
|
|
this.ziadelclientRef = zitadelclientRefArg;
|
|
this.data = dataArg;
|
|
}
|
|
|
|
public async listProjectRoles() {
|
|
const returnRoles: ZitadelProjectRole[] = [];
|
|
const response = await this.ziadelclientRef.managementClient.listProjectRoles({
|
|
projectId: this.data.id,
|
|
});
|
|
for (const roleObject of response.result) {
|
|
returnRoles.push(new ZitadelProjectRole(this.ziadelclientRef, {
|
|
project: this,
|
|
name: roleObject.displayName,
|
|
key: roleObject.key,
|
|
}));
|
|
}
|
|
return returnRoles;
|
|
}
|
|
} |