Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/strapi-admin/services/permission/sections-builder/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
const createSection = require('./section');
/**
* Create a new section builder with its own sections registry
*/
const createSectionBuilder = () => {
const state = {
sections: new Map(),
};
return {
/**
* Create & add a section to the builder's registry
* @param {string} sectionName - The unique name of the section
* @param {SectionOptions} options - The options used to build a {@link Section}
* @return {this}
*/
createSection(sectionName, options) {
const section = createSection(options);
state.sections.set(sectionName, section);
return this;
},
/**
* Removes a section from the builder's registry using its unique name
* @param {string} sectionName - The name of the section to delete
* @return {this}
*/
deleteSection(sectionName) {
state.sections.remove(sectionName);
return this;
},
/**
* Register a handler function for a given section
* @param {string} sectionName - The name of the section
* @param {Function} handler - The handler to register
* @return {this}
*/
addHandler(sectionName, handler) {
if (state.sections.has(sectionName)) {
state.sections.get(sectionName).hooks.handlers.register(handler);
}
return this;
},
/**
* Register a matcher function for a given section
* @param {string} sectionName - The name of the section
* @param {Function} matcher - The handler to register
* @return {this}
*/
addMatcher(sectionName, matcher) {
if (state.sections.has(sectionName)) {
state.sections.get(sectionName).hooks.matchers.register(matcher);
}
return this;
},
/**
* Build a section tree based on the registered actions and the given actions
* @param {Array<Action>} actions - The actions used to build each section
* @return {Promise<any>}
*/
async build(actions = []) {
const sections = {};
for (const [sectionName, section] of state.sections.entries()) {
sections[sectionName] = await section.build(actions);
}
return sections;
},
};
};
module.exports = createSectionBuilder;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0484 ]-- |