import { UMB_CURRENT_USER_CONTEXT } from '../../../../user/current-user/index.js';
import { UmbConditionBase } from '../../../extension-registry/index.js';
const ObserveSymbol = Symbol();
export class UmbSectionUserPermissionCondition extends UmbConditionBase {
    constructor(host, args) {
        super(host, args);
        this.consumeContext(UMB_CURRENT_USER_CONTEXT, (context) => {
            this.observe(context?.currentUser, (currentUser) => {
                const allowedSections = currentUser?.allowedSections ?? [];
                this.permitted = allowedSections.includes(this.config.match);
            }, ObserveSymbol);
        });
    }
}
