mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +02:00
chore!: remove deprecated delete project groups roles endpoint (#10036)
https://linear.app/unleash/issue/2-3362/remove-delete-apiadminprojectsprojectidgroupsgroupidrolesroleid Removes DELETE `/api/admin/projects/{projectId}/groups/{groupId}/roles/{roleId}` which was deprecated in v5.5. Also cleans up related code.
This commit is contained in:
parent
b111abc96f
commit
1f4aa0ed34
@ -554,20 +554,6 @@ export class AccessStore implements IAccessStore {
|
||||
});
|
||||
}
|
||||
|
||||
async removeGroupFromRole(
|
||||
groupId: number,
|
||||
roleId: number,
|
||||
projectId?: string,
|
||||
): Promise<void> {
|
||||
return this.db(T.GROUP_ROLE)
|
||||
.where({
|
||||
group_id: groupId,
|
||||
role_id: roleId,
|
||||
project: projectId,
|
||||
})
|
||||
.delete();
|
||||
}
|
||||
|
||||
async updateUserProjectRole(
|
||||
userId: number,
|
||||
roleId: number,
|
||||
|
@ -79,7 +79,6 @@ export const PROJECT_USER_ADDED = 'project-user-added' as const;
|
||||
export const PROJECT_USER_REMOVED = 'project-user-removed' as const;
|
||||
export const PROJECT_USER_ROLE_CHANGED = 'project-user-role-changed' as const;
|
||||
export const PROJECT_GROUP_ADDED = 'project-group-added' as const;
|
||||
export const PROJECT_GROUP_REMOVED = 'project-group-removed' as const;
|
||||
export const PROJECT_GROUP_ROLE_CHANGED = 'project-group-role-changed' as const;
|
||||
export const DROP_PROJECTS = 'drop-projects' as const;
|
||||
export const TAG_CREATED = 'tag-created' as const;
|
||||
@ -273,7 +272,6 @@ export const IEventTypes = [
|
||||
PROJECT_USER_ROLE_CHANGED,
|
||||
PROJECT_GROUP_ROLE_CHANGED,
|
||||
PROJECT_GROUP_ADDED,
|
||||
PROJECT_GROUP_REMOVED,
|
||||
ROLE_CREATED,
|
||||
ROLE_UPDATED,
|
||||
ROLE_DELETED,
|
||||
|
@ -45,7 +45,6 @@ import {
|
||||
ProjectCreatedEvent,
|
||||
ProjectDeletedEvent,
|
||||
ProjectGroupAddedEvent,
|
||||
ProjectGroupRemovedEvent,
|
||||
ProjectGroupUpdateRoleEvent,
|
||||
ProjectRevivedEvent,
|
||||
ProjectUpdatedEvent,
|
||||
@ -805,44 +804,6 @@ export default class ProjectService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use removeGroupAccess
|
||||
*/
|
||||
async removeGroup(
|
||||
projectId: string,
|
||||
roleId: number,
|
||||
groupId: number,
|
||||
auditUser: IAuditUser,
|
||||
): Promise<void> {
|
||||
const group = await this.groupService.getGroup(groupId);
|
||||
const role = await this.accessService.getRole(roleId);
|
||||
const project = await this.getProject(projectId);
|
||||
if (group.id == null)
|
||||
throw new ValidationError(
|
||||
'Unexpected empty group id',
|
||||
[],
|
||||
undefined,
|
||||
);
|
||||
|
||||
await this.accessService.removeGroupFromRole(
|
||||
group.id,
|
||||
role.id,
|
||||
project.id,
|
||||
);
|
||||
|
||||
await this.eventService.storeEvent(
|
||||
new ProjectGroupRemovedEvent({
|
||||
project: projectId,
|
||||
auditUser,
|
||||
preData: {
|
||||
groupId: group.id,
|
||||
projectId: project.id,
|
||||
roleName: role.name,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private isAdmin(userId: number, roles: IRoleWithProject[]): boolean {
|
||||
return (
|
||||
userId === SYSTEM_USER_ID ||
|
||||
|
@ -455,14 +455,6 @@ export class AccessService {
|
||||
return this.store.removeUserFromRole(userId, roleId, projectId);
|
||||
}
|
||||
|
||||
async removeGroupFromRole(
|
||||
groupId: number,
|
||||
roleId: number,
|
||||
projectId: string,
|
||||
): Promise<void> {
|
||||
return this.store.removeGroupFromRole(groupId, roleId, projectId);
|
||||
}
|
||||
|
||||
async updateUserProjectRole(
|
||||
userId: number,
|
||||
roleId: number,
|
||||
|
@ -77,7 +77,6 @@ import {
|
||||
PROJECT_ENVIRONMENT_REMOVED,
|
||||
PROJECT_FAVORITED,
|
||||
PROJECT_GROUP_ADDED,
|
||||
PROJECT_GROUP_REMOVED,
|
||||
PROJECT_GROUP_ROLE_CHANGED,
|
||||
PROJECT_IMPORT,
|
||||
PROJECT_REVIVED,
|
||||
@ -1038,28 +1037,6 @@ export class ProjectGroupAddedEvent extends BaseEvent {
|
||||
}
|
||||
}
|
||||
|
||||
export class ProjectGroupRemovedEvent extends BaseEvent {
|
||||
readonly project: string;
|
||||
|
||||
readonly data: any;
|
||||
|
||||
readonly preData: any;
|
||||
|
||||
/**
|
||||
*/
|
||||
constructor(p: {
|
||||
project: string;
|
||||
preData: any;
|
||||
auditUser: IAuditUser;
|
||||
}) {
|
||||
super(PROJECT_GROUP_REMOVED, p.auditUser);
|
||||
const { project, preData } = p;
|
||||
this.project = project;
|
||||
this.data = null;
|
||||
this.preData = preData;
|
||||
}
|
||||
}
|
||||
|
||||
export class ProjectGroupUpdateRoleEvent extends BaseEvent {
|
||||
readonly project: string;
|
||||
|
||||
|
@ -131,12 +131,6 @@ export interface IAccessStore extends Store<IRole, number> {
|
||||
projectId?: string,
|
||||
): Promise<void>;
|
||||
|
||||
removeGroupFromRole(
|
||||
groupId: number,
|
||||
roleId: number,
|
||||
projectId?: string,
|
||||
): Promise<void>;
|
||||
|
||||
updateUserProjectRole(
|
||||
userId: number,
|
||||
roleId: number,
|
||||
|
8
src/test/fixtures/fake-access-store.ts
vendored
8
src/test/fixtures/fake-access-store.ts
vendored
@ -69,14 +69,6 @@ export class FakeAccessStore implements IAccessStore {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
removeGroupFromRole(
|
||||
groupId: number,
|
||||
roleId: number,
|
||||
projectId?: string,
|
||||
): Promise<void> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
updateUserProjectRole(
|
||||
userId: number,
|
||||
roleId: number,
|
||||
|
Loading…
Reference in New Issue
Block a user