merge: Add a role policy for viewing federation info (!1219)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1219 Approved-by: Luna <her@mint.lgbt> Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
commit
0a9f730b59
22 changed files with 84 additions and 13 deletions
|
|
@ -70,6 +70,7 @@ export type RolePolicies = {
|
|||
canImportUserLists: boolean;
|
||||
chatAvailability: 'available' | 'readonly' | 'unavailable';
|
||||
canTrend: boolean;
|
||||
canViewFederation: boolean;
|
||||
};
|
||||
|
||||
export const DEFAULT_POLICIES: RolePolicies = {
|
||||
|
|
@ -110,6 +111,7 @@ export const DEFAULT_POLICIES: RolePolicies = {
|
|||
canImportUserLists: true,
|
||||
chatAvailability: 'available',
|
||||
canTrend: true,
|
||||
canViewFederation: true,
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
|
|
@ -472,6 +474,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
|||
canImportUserLists: calc('canImportUserLists', vs => vs.some(v => v === true)),
|
||||
chatAvailability: calc('chatAvailability', aggregateChatAvailability),
|
||||
canTrend: calc('canTrend', vs => vs.some(v => v === true)),
|
||||
canViewFederation: calc('canViewFederation', vs => vs.some(v => v === true)),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -313,6 +313,10 @@ export const packedRolePoliciesSchema = {
|
|||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
canViewFederation: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import { schema } from '@/core/chart/charts/entities/federation.js';
|
|||
export const meta = {
|
||||
tags: ['charts'],
|
||||
|
||||
requiredRolePolicy: 'canViewFederation',
|
||||
|
||||
res: getJsonSchema(schema),
|
||||
|
||||
allowGet: true,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import { schema } from '@/core/chart/charts/entities/instance.js';
|
|||
export const meta = {
|
||||
tags: ['charts'],
|
||||
|
||||
requiredRolePolicy: 'canViewFederation',
|
||||
|
||||
res: getJsonSchema(schema),
|
||||
|
||||
allowGet: true,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { FollowingEntityService } from '@/core/entities/FollowingEntityService.j
|
|||
export const meta = {
|
||||
tags: ['federation'],
|
||||
|
||||
requiredRolePolicy: 'canViewFederation',
|
||||
requireCredential: true,
|
||||
kind: 'read:account',
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { FollowingEntityService } from '@/core/entities/FollowingEntityService.j
|
|||
export const meta = {
|
||||
tags: ['federation'],
|
||||
|
||||
requiredRolePolicy: 'canViewFederation',
|
||||
requireCredential: true,
|
||||
kind: 'read:account',
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import { sqlLikeEscape } from '@/misc/sql-like-escape.js';
|
|||
export const meta = {
|
||||
tags: ['federation'],
|
||||
|
||||
requiredRolePolicy: 'canViewFederation',
|
||||
requireCredential: false,
|
||||
allowGet: true,
|
||||
cacheSec: 3600,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import { DI } from '@/di-symbols.js';
|
|||
export const meta = {
|
||||
tags: ['federation'],
|
||||
|
||||
requiredRolePolicy: 'canViewFederation',
|
||||
requireCredential: false,
|
||||
|
||||
res: {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import { DI } from '@/di-symbols.js';
|
|||
export const meta = {
|
||||
tags: ['federation'],
|
||||
|
||||
requiredRolePolicy: 'canViewFederation',
|
||||
requireCredential: false,
|
||||
|
||||
allowGet: true,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import { DI } from '@/di-symbols.js';
|
|||
export const meta = {
|
||||
tags: ['federation'],
|
||||
|
||||
requiredRolePolicy: 'canViewFederation',
|
||||
requireCredential: false,
|
||||
|
||||
res: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue