misc: added support for removing instance admin access of users

This commit is contained in:
Sheen Capadngan
2025-03-19 02:13:24 +08:00
parent d91add2e7b
commit 015a193330
5 changed files with 155 additions and 40 deletions
@@ -453,6 +453,17 @@ export const superAdminServiceFactory = ({
return identity;
};
const deleteUserSuperAdminAccess = async (userId: string) => {
const user = await userDAL.findById(userId);
if (!user) {
throw new NotFoundError({ name: "User", message: "User not found" });
}
const updatedUser = userDAL.updateById(userId, { superAdmin: false });
return updatedUser;
};
const getIdentities = async ({ offset, limit, searchTerm }: TAdminGetIdentitiesDTO) => {
const identities = await identityDAL.getIdentitiesByFilter({
limit,
@@ -571,6 +582,7 @@ export const superAdminServiceFactory = ({
updateRootEncryptionStrategy,
getConfiguredEncryptionStrategies,
grantServerAdminAccessToUser,
deleteIdentitySuperAdminAccess
deleteIdentitySuperAdminAccess,
deleteUserSuperAdminAccess
};
};