user required for site admin badge create
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -949,7 +949,16 @@ const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
Fn: 'custom:dynamicAuthorizations',
args: {
asserts: [],
- filters: ['SitesAdmin', 'LocalIssuer']
+ filters: ['SitesAdmin', 'LocalIssuer'],
+ metadata: {
+ userID: {
+ visible: true,
+ enabled: true,
+ mandatory: true,
+ values: [],
+ defaultValue: null,
+ }
+ },
}
},
attributes: [

MODIFY
src/server/rest/v1/service/AuthorizationService.ts
src/server/rest/v1/service/AuthorizationService.ts
@@ -279,6 +279,7 @@ export default class AuthorizationService {
tags.canImport = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.TAGS, Action.IMPORT, authorizationFilter);
tags.canExport = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.TAGS, Action.EXPORT, authorizationFilter);
tags.canUnassign = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.TAGS, Action.UNASSIGN, authorizationFilter);
+ tags.metadata = authorizationFilter.metadata;
// Enrich
for (const tag of tags.result) {
await AuthorizationService.addTagAuthorizations(tenant, userToken, tag, authorizationFilter);
@@ -753,6 +754,7 @@ export default class AuthorizationService {
if (authorizationFilters.authorized) {
AuthorizationService.processDynamicAsserts(tenant, userToken, authAction, entity,
authorizationFilters, authorizationContext, entityData);
+ authorizationFilters.metadata = authResult.context.metadata;
}
// Filter projected fields
authorizationFilters.projectFields = AuthorizationService.filterProjectFields(

MODIFY
src/types/DataResult.ts
src/types/DataResult.ts
@@ -15,6 +15,7 @@ export interface DataResult<T> {
count: number;
result: T[];
projectFields?: string[];
+ metadata?: Record<string, unknown>;
}
export interface CompanyDataResult extends DataResult<Company>{

user required for site admin badge create