feat: go greppy

This commit is contained in:
=
2025-10-10 00:09:48 +05:30
parent fe1bc168f6
commit 97135d9cfa
46 changed files with 150 additions and 106 deletions
@@ -52,8 +52,7 @@ export const membershipIdentityDALFactory = (db: TDbClient) => {
} else if (scopeData.scope === AccessScope.Namespace) {
void qb
.where(`${TableName.Membership}.scope`, AccessScope.Namespace)
.where(`${TableName.Membership}.scopeNamespaceId`, scopeData.namespaceId)
.whereNull(`${TableName.Membership}.scopeNamespaceId`);
.where(`${TableName.Membership}.scopeNamespaceId`, scopeData.namespaceId);
} else if (scopeData.scope === AccessScope.Project) {
void qb
.where(`${TableName.Membership}.scope`, AccessScope.Project)
@@ -236,8 +235,7 @@ export const membershipIdentityDALFactory = (db: TDbClient) => {
} else if (scopeData.scope === AccessScope.Namespace) {
void qb
.where(`${TableName.Membership}.scope`, AccessScope.Namespace)
.where(`${TableName.Membership}.scopeNamespaceId`, scopeData.namespaceId)
.whereNull(`${TableName.Membership}.scopeNamespaceId`);
.where(`${TableName.Membership}.scopeNamespaceId`, scopeData.namespaceId);
} else if (scopeData.scope === AccessScope.Project) {
void qb
.where(`${TableName.Membership}.scope`, AccessScope.Project)
@@ -63,7 +63,7 @@ export const membershipIdentityServiceFactory = ({
const hasNoPermanentRole = data.roles.every((el) => el.isTemporary);
if (hasNoPermanentRole) {
throw new BadRequestError({
message: "Identity must have atleast one permanent role"
message: "Identity must have at least one permanent role"
});
}
const isInvalidTemporaryRole = data.roles.some((el) => {
@@ -157,7 +157,7 @@ export const membershipIdentityServiceFactory = ({
const hasNoPermanentRole = data.roles.every((el) => el.isTemporary);
if (hasNoPermanentRole) {
throw new BadRequestError({
message: "Identity must have atleast one permanent role"
message: "Identity must have at least one permanent role"
});
}
const isInvalidTemporaryRole = data.roles.some((el) => {
@@ -24,31 +24,31 @@ export const newNamespaceMembershipIdentityFactory = (
};
const isCustomRole: TMembershipIdentityScopeFactory["isCustomRole"] = () => {
throw new InternalServerError({ message: "Namespace membership user isCustomRole not implemented" });
throw new InternalServerError({ message: "Namespace membership identity isCustomRole not implemented" });
};
const onCreateMembershipIdentityGuard: TMembershipIdentityScopeFactory["onCreateMembershipIdentityGuard"] =
async () => {
throw new InternalServerError({ message: "Namespace membership user create not implemented" });
throw new InternalServerError({ message: "Namespace membership identity create not implemented" });
};
const onUpdateMembershipIdentityGuard: TMembershipIdentityScopeFactory["onUpdateMembershipIdentityGuard"] =
async () => {
throw new InternalServerError({ message: "Namespace membership user update not implemented" });
throw new InternalServerError({ message: "Namespace membership identity update not implemented" });
};
const onDeleteMembershipIdentityGuard: TMembershipIdentityScopeFactory["onDeleteMembershipIdentityGuard"] =
async () => {
throw new InternalServerError({ message: "Namespace membership user delete not implemented" });
throw new InternalServerError({ message: "Namespace membership identity delete not implemented" });
};
const onListMembershipIdentityGuard: TMembershipIdentityScopeFactory["onListMembershipIdentityGuard"] = async () => {
throw new InternalServerError({ message: "Namespace membership user list not implemented" });
throw new InternalServerError({ message: "Namespace membership identity list not implemented" });
};
const onGetMembershipIdentityByIdentityIdGuard: TMembershipIdentityScopeFactory["onGetMembershipIdentityByIdentityIdGuard"] =
async () => {
throw new InternalServerError({ message: "Namespace membership user get by user id not implemented" });
throw new InternalServerError({ message: "Namespace membership identity get by identity id not implemented" });
};
return {
@@ -74,7 +74,7 @@ export const newOrgMembershipIdentityFactory = ({
if (!permissionBoundary.isValid)
throw new PermissionBoundaryError({
message: constructPermissionErrorMessage(
"Failed to create identity org membership",
"Failed to update identity org membership",
shouldUseNewPrivilegeSystem,
OrgPermissionIdentityActions.GrantPrivileges,
OrgPermissionSubjects.Identity
@@ -88,7 +88,7 @@ export const newOrgMembershipIdentityFactory = ({
const onDeleteMembershipIdentityGuard: TMembershipIdentityScopeFactory["onDeleteMembershipIdentityGuard"] =
async () => {
throw new BadRequestError({
message: "Organization membership cannot be created for organization scoped identity"
message: "Organization membership cannot be deleted for organization scoped identity"
});
};
@@ -129,7 +129,7 @@ export const newProjectMembershipIdentityFactory = ({
if (!permissionBoundary.isValid)
throw new PermissionBoundaryError({
message: constructPermissionErrorMessage(
"Failed to create identity project membership",
"Failed to update identity project membership",
shouldUseNewPrivilegeSystem,
ProjectPermissionIdentityActions.GrantPrivileges,
ProjectPermissionSub.Identity