This commit is contained in:
Wayne
2025-08-22 13:47:48 +03:00
parent faadc2fad6
commit 317f034c56
3 changed files with 18 additions and 24 deletions

View File

@@ -52,7 +52,6 @@ export class IamController {
return;
}
try {
for (const statement of policies) {
const { valid, reason } = PolicyValidator.isValid(statement as CaslPolicy);
@@ -120,27 +119,27 @@ export class IamController {
'End user',
[
{
"action": "read",
"subject": "dashboard"
action: 'read',
subject: 'dashboard',
},
{
"action": "create",
"subject": "ingestion"
action: 'create',
subject: 'ingestion',
},
{
"action": "manage",
"subject": "ingestion",
"conditions": {
"userId": "${user.id}"
}
action: 'manage',
subject: 'ingestion',
conditions: {
userId: '${user.id}',
},
},
{
"action": "manage",
"subject": "archive",
"conditions": {
"ingestionSource.userId": "${user.id}"
}
}
action: 'manage',
subject: 'archive',
conditions: {
'ingestionSource.userId': '${user.id}',
},
},
],
'predefined_end_user'
);

View File

@@ -18,8 +18,6 @@ export type SubjectObject =
| InferSelectModel<typeof roles>
| AppSubjects;
// Function to create an ability instance from policies stored in the database
export function createAbilityFor(policies: CaslPolicy[]) {
// We will not expand policies, if a role needs access to ingestion X and its archived emails, the policy should also grant access to archives belonging to ingestion X
@@ -28,7 +26,6 @@ export function createAbilityFor(policies: CaslPolicy[]) {
return createMongoAbility<AppAbility>(policies as AppRawRule[]);
}
/**
* @deprecated This function should not be used since we don't need the inheritable behavior anymore.
* Translates conditions on an 'ingestion' subject to equivalent conditions on an 'archive' subject.
@@ -71,7 +68,6 @@ function translateIngestionConditionsToArchive(
return translated;
}
/**
* @deprecated This function should not be used since we don't need the inheritable behavior anymore.
* Expands the given set of policies to include inherent permissions.
@@ -116,7 +112,7 @@ function expandPolicies(policies: CaslPolicy[]): CaslPolicy[] {
}
});
policies.forEach((policy) => { });
policies.forEach((policy) => {});
return expandedPolicies;
}
}

View File

@@ -14,7 +14,7 @@ export const load: PageServerLoad = async (event) => {
let ingestionSources: IngestionSource[] = sourcesResponseText;
if (!sourcesResponse.ok) {
if (sourcesResponse.status === 403) {
ingestionSources = []
ingestionSources = [];
} else {
return error(
sourcesResponse.status,
@@ -23,7 +23,6 @@ export const load: PageServerLoad = async (event) => {
}
}
let archivedEmails: PaginatedArchivedEmails = {
items: [],
total: 0,