|
|
|
@ -25,7 +25,11 @@ import {
|
|
|
|
|
TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS,
|
|
|
|
|
TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS,
|
|
|
|
|
} from '../tokens/extensions.token';
|
|
|
|
|
import { CanActivateFn } from '@angular/router';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use `TenantManagementExtensionsGuardFn` instead.
|
|
|
|
|
*/
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class TenantManagementExtensionsGuard implements IAbpGuard {
|
|
|
|
|
protected readonly configState = inject(ConfigStateService);
|
|
|
|
@ -81,3 +85,55 @@ export class TenantManagementExtensionsGuard implements IAbpGuard {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const TenantManagementExtensionsGuardFn: CanActivateFn = () => {
|
|
|
|
|
const configState = inject(ConfigStateService);
|
|
|
|
|
const extensions = inject(ExtensionsService);
|
|
|
|
|
|
|
|
|
|
const config = { optional: true };
|
|
|
|
|
|
|
|
|
|
const actionContributors = inject(TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS, config) || {};
|
|
|
|
|
const toolbarContributors = inject(TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, config) || {};
|
|
|
|
|
const propContributors = inject(TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, config) || {};
|
|
|
|
|
const createFormContributors =
|
|
|
|
|
inject(TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS, config) || {};
|
|
|
|
|
const editFormContributors = inject(TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS, config) || {};
|
|
|
|
|
|
|
|
|
|
return getObjectExtensionEntitiesFromStore(configState, 'TenantManagement').pipe(
|
|
|
|
|
map(entities => ({
|
|
|
|
|
[eTenantManagementComponents.Tenants]: entities.Tenant,
|
|
|
|
|
})),
|
|
|
|
|
mapEntitiesToContributors(configState, 'TenantManagement'),
|
|
|
|
|
tap(objectExtensionContributors => {
|
|
|
|
|
mergeWithDefaultActions(
|
|
|
|
|
extensions.entityActions,
|
|
|
|
|
DEFAULT_TENANT_MANAGEMENT_ENTITY_ACTIONS,
|
|
|
|
|
actionContributors,
|
|
|
|
|
);
|
|
|
|
|
mergeWithDefaultActions(
|
|
|
|
|
extensions.toolbarActions,
|
|
|
|
|
DEFAULT_TENANT_MANAGEMENT_TOOLBAR_ACTIONS,
|
|
|
|
|
toolbarContributors,
|
|
|
|
|
);
|
|
|
|
|
mergeWithDefaultProps(
|
|
|
|
|
extensions.entityProps,
|
|
|
|
|
DEFAULT_TENANT_MANAGEMENT_ENTITY_PROPS,
|
|
|
|
|
objectExtensionContributors.prop,
|
|
|
|
|
propContributors,
|
|
|
|
|
);
|
|
|
|
|
mergeWithDefaultProps(
|
|
|
|
|
extensions.createFormProps,
|
|
|
|
|
DEFAULT_TENANT_MANAGEMENT_CREATE_FORM_PROPS,
|
|
|
|
|
objectExtensionContributors.createForm,
|
|
|
|
|
createFormContributors,
|
|
|
|
|
);
|
|
|
|
|
mergeWithDefaultProps(
|
|
|
|
|
extensions.editFormProps,
|
|
|
|
|
DEFAULT_TENANT_MANAGEMENT_EDIT_FORM_PROPS,
|
|
|
|
|
objectExtensionContributors.editForm,
|
|
|
|
|
editFormContributors,
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
map(() => true),
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|