Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@lcharette/configmanager
Advanced tools
UI for core and custom site settings for UserFrosting 5.1
Configuration Manager sprinkle for UserFrosting 5. Lets you edit UserFrosting configs from the interface.
If you need help using this sprinkle or found any bug, feels free to open an issue or submit a pull request. You can also find me on the UserFrosting Chat most of the time for direct support.
To install in your Sprinkle :
Add this package with Composer :
composer require lcharette/uf_configmanager "~5.1.0"
Edit your Sprinkle Recipe to include the ConfigManager as a Sprinkle dependency :
\UserFrosting\Sprinkle\ConfigManager\ConfigManager::class
Add Config Manager frontend assets dependencies :
npm i --save @lcharette/configmanager@~5.1.0
Add Config Manager & FormGenerator frontend entries to your webpack entries. Open webpack.config.js
and add in const sprinkles { ... }
:
FormGenerator: require('@lcharette/formgenerator/webpack.entries'),
ConfigManager: require('@lcharette/configmanager/webpack.entries'),
Run :
php bakery bake
The public/
directory serves as an example of ConfigManager. You can clone this repository and install as any UserFrosting 5 sprinkle :
composer install
php bakery bake
php -S localhost:8080 -t public
The migration will automatically add the update_site_config
permission to the Site Administrator
role. If it's not added automatically, you can run the UserFrosting\Sprinkle\ConfigManager\Database\Seeds\SettingsPermissions
seed using the php bakery seed
command or add it manually in the admin UI. To give access to the config UI to another user, simply add the update_site_config
permission slug to that user role.
The configuration UI is bound to the the /settings
route. Simply add a link to this route where you want it. The checkAccess make it so it will appear only for users having the appropriate permission. For example, you can add the following to the sidebar menu :
{% if checkAccess('update_site_config') %}
<li>
<a href="{{site.uri.public}}/settings"><i class="fa fa-gears fa-fw"></i> <span>{{ translate("CONFIG_MANAGER.TITLE") }}</span></a>
</li>
{% endif %}
Settings are separated by topics in the UI. Each topic is represented by a file, located in schema/config/
. Unlike normal schema files, all entries needs to be wrapped inside a config
key. A name
and desc
top-level entry will allow to define the title and description of the topic.
{
"name" : "SITE.CONFIG",
"desc" : "SITE.CONFIG.DESC",
"config": { ... }
}
For example, to add an entry for site.title
text and site.registration.enabled
checkbox option in a "UserFrosting Settings" topic :
{
"name" : "SITE.CONFIG",
"desc" : "SITE.CONFIG.DESC",
"config": {
"site.title" : {
"validators" : {
"required" : {
"message" : "SITE.TITLE.REQUIRED"
}
},
"form" : {
"type" : "text",
"label" : "SITE.TITLE",
"icon" : "fa-comment"
}
},
"site.registration.enabled" : {
"validators" : {},
"form" : {
"type" : "checkbox",
"label" : "SITE.REGISTRATION.ENABLED"
}
}
}
}
NOTE Only
.json
are accepted.Yaml
schemas are cannot be used for now.
By Louis Charette. Copyright (c) 2020, free to use in personal and commercial software as per the MIT license.
FAQs
UI for core and custom site settings for UserFrosting 5.1
We found that @lcharette/configmanager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.