raffaelj / cockpit-rljutils

Cockpit CMS v1 的插件,增加了加固、外观和辅助功能

安装: 39

依赖项: 1

建议者: 0

安全: 0

星标: 5

关注者: 2

分支: 3

公开问题: 0

类型:cockpit-module

0.1.7 2022-12-18 15:00 UTC

This package is auto-updated.

Last update: 2024-09-24 18:50:16 UTC


README

此插件与Cockpit CMS v2不兼容。

请参阅Cockpit CMS v1 文档Cockpit CMS v1 仓库以及Cockpit CMS v2 文档Cockpit CMS v2 仓库

Cockpit CMS 插件,增加了加固、外观和辅助功能

当使用具有多个用户的Cockpit时,需要一些自定义。默认情况下,一些辅助函数绕过了用户组访问控制列表或它们说太多,因此确实需要一些调整。此插件还添加了一些UI调整和辅助功能。

此插件有助于您忘记调整某些值并将它们设置为默认值。它还包含一些片段,我过去一年在cockpit-scripts 仓库中收集的。

一些调整是基于观点的。我喜欢它们,并编写此插件作为满足我需求的基础。将代码作为灵感,或者如果您有建议,请随时提交问题或发送拉取请求。

更多选项和辅助功能可能很快就会到来...

警告:如果您启用collections_findcollections_treecollections_collections,您可能会在集合链接字段遇到一些问题。

安装

将此存储库复制到/addons并命名为rljUtils,或使用cli。

通过git

cd path/to/cockpit
git clone https://github.com/raffaelj/cockpit_rljUtils.git addons/rljUtils

通过cp cli

cd path/to/cockpit
./cp install/addon --name rljUtils --url https://github.com/raffaelj/cockpit_rljUtils/archive/master.zip

通过composer

确保在项目的composer.json文件中定义了cockpit插件的路径。

{
    "name": "my/cockpit-project",
    "extra": {
        "installer-paths": {
            "addons/{$name}": ["type:cockpit-module"]
        }
    }
}
cd path/to/cockpit-root
composer create-project --ignore-platform-reqs aheinze/cockpit .
composer config extra.installer-paths.addons/{\$name} "type:cockpit-module"

composer require --ignore-platform-reqs raffaelj/cockpit-rljutils

使用

默认情况下,除locked_entries_disabled之外的所有选项都已启用。

通过config/config.yaml或通过“设置”-->“rljUtils”下的UI禁用它们

向下滚动查看示例配置。

功能

加固

  • 如果未定义,将allowed_uploads设置为'jpg, jpeg, png, gif, svg, pdf, ods, odt, doc, docx, xls, xlsx'
  • 如果未定义,将max_upload_size设置为4MB
  • 限制绕过组acl的集合辅助函数/路由(用于集合链接,对于纯API使用是可接受的,但在管理UI中是不安全的)
    • find_find
    • tree
    • _collections
  • 禁用完全绕过ACL的辅助路由
    • /collecitons/utils/getLinkedOverview
  • 限制账户辅助函数/路由/accounts/find
    • 禁用非管理员的全局用户列表
    • 仅在通过id过滤的情况下返回用户数据
    • 只返回所需的数据(用户、名称、组、_id),而不是个人电子邮件地址
  • 新acl规则assets - 如果未启用,用户组无法访问assetsmanager

外观

  • 禁用仪表板中的计时器小部件
  • 将编辑视图中的默认条目组设置为“主”(默认为“全部”) - 如果您按类别拆分字段,例如SEO和配置,则在启动时看到整个列表会有些烦恼
  • 在操作面板中添加一些大型的彩色语言按钮(我总是在更改本地化值后忘记切换回来)
  • 将 wysiwyg 字段的实体编码设置为原始以防止特殊字符替换(ä 转换为 ä),这样带有特殊字符的全文搜索就能按预期工作
  • 在系统菜单中添加暗黑模式切换

辅助工具

  • 禁用条目锁定功能 - 在使用多个浏览器开发和测试时,等待条目解锁真的非常令人烦恼。此外,我的 Firefox 设置了一些隐私设置,因此关闭标签或点击“取消”时永远不会发送解锁信号。

示例配置

config.php

return [
    "app.name" => "rljUtils Test",
    "languages" => [
        "default" => "English",
        "de"      => "Deutsch",
    ],

    "groups" => [
        "manager" => [
            "cockpit" => [
                "backend" => true,
                "accounts" => true,
                "assets" => true,
            ],
        ],
        "author" => [
            "cockpit" => [
                "backend" => true,
                "assets" => true,
            ],
        ],
        "guest" => [
            "cockpit" => [
                "backend" => true,
            ],
        ],
    ],

    "rljutils" => [
        'hardening' => [
            'allowed_uploads'           => false,
            'max_upload_size'           => false,
            'collections_find'          => false,
            'collections_tree'          => false,
            'collections_collections'   => false,
            'accounts_find'             => false,
            'assetsmanager'             => false,
            'disable_getLinkedOverview' => false,
        ],
        'cosmetics' => [
            'widgets_timer_disabled'    => false,
            'entry_default_group_main'  => false,
            'entry_language_buttons'    => false,
            'wysiwyg_entity_encoding_raw' => false,
            'dark_mode_switch'          => false,
            'display_sortable_entries'  => false,
            'autofocus_login'           => false,
        ],
        'helpers' => [
            // entry lock is annoying while developing and testing with multiple browsers
            'locked_entries_disabled'   => true,
            'log_exceptions'            => false,
        ],
    ],
];

屏幕截图

rljUtils-language-buttons

rljUtils-settings