xlabs / boardbundle
1.0.5
2023-05-19 15:32 UTC
Requires
- composer/installers: ~1.0
Requires (Dev)
- atm/commentbundle: ~1.0
- atm/emojisbundle: ~1.0
- doctrine/doctrine-bundle: ~1.4
- doctrine/orm: ^2.4.8
- dyninc/dyn-php: ^0.9.0
- friendsofsymfony/jsrouting-bundle: ^1.6
- qencode/api-client: 1.03.*
- xlabs/likebundle: ^1.0
- xlabs/resultcachebundle: ^1.0
Suggests
- symfony/asset: For using the AssetExtension
- symfony/expression-language: For using the ExpressionExtension
- symfony/finder: For using the finder
- symfony/form: For using the FormExtension
- symfony/http-kernel: For using the HttpKernelExtension
- symfony/routing: For using the RoutingExtension
- symfony/security: For using the SecurityExtension
- symfony/stopwatch: For using the StopwatchExtension
- symfony/templating: For using the TwigEngine
- symfony/translation: For using the TranslationExtension
- symfony/var-dumper: For using the DumpExtension
- symfony/yaml: For using the YamlExtension
README
通过composer安装
php -d memory_limit=-1 composer.phar require atm/boardbundle
在AppKernel中
public function registerbundles()
{
return [
...
...
new ATM\BoardBundle\ATMBoardBundle(),
];
}
配置示例
# app/config/config.yml
atm_board:
media_folder: Media folder.
user: Your user namespace.
image_width: width of the post image.
image_height: height of the post image.
watermark_image_small: small watermark path.
watermark_image_medium: medium watermark path.
watermark_image_big: big watermark path.
encoder_api_key: encoder api key from qencode.
encoder_profile_id: encoder profile id from qencode.
encoder_transfer_method_id: encoder profile id from qencode.
not_access_redirect_route: Redirect route when a user has no access to the board.
after_request_access_redirect_route: Redirect route after a request has sent to a user.
added_to_acl_redirect_route: Redirect route after a user is added to the acl.
removed_to_acl_redirect_route: Redirect route after a user is removed to the acl.
路由
追加到主路由文件
# app/config/routing.yml
atm_board:
resource: "@ATMBoardBundle/Controller/BoardController.php"
type: annotation
prefix: /
atm_board_admin:
resource: "@ATMBoardBundle/Controller/AdminController.php"
type: annotation
prefix: /
atm_board_qencode:
resource: "@ATMBoardBundle/Controller/QEncodeController.php"
type: annotation
prefix: /
用法
首先使用以下路由创建板块
{{ path('atm_board_create')
创建板块后,您可以添加帖子图片、视频和文本。对于视频,您需要在控制台中启动rabbitMQ队列
- atm_board_encode_video:execute
访问控制列表(ACL)
板块系统还允许给予板块所有者想要赋予访问权限的用户。首先,想要访问您板块的用户必须使用此路由向您发送请求
{{ path('atm_board_request_access') }}
此路由的动作会触发以下事件
atm_board_request_access.event
在该事件中,您可以自定义板块所有者获取链接以添加想要检查板块的用户的方式。这是将用户添加到板块ACL的路由
{{ path('atm_board_add_user_acl',{ 'boardId':board.id, 'userId':user.id }) }}
将用户添加到板块的ACL后,会抛出以下事件,其中包含添加到板块ACL的板块ID和用户ID作为参数
atm_board_added_acl.event
如果板块所有者想要从板块中移除用户,这是执行此操作的路由
{{ path('atm_board_remove_user_acl',{ 'boardId':board.id, 'userId':user.id }) }}
此动作会抛出以下事件,其中包含从板块ACL中移除的板块ID和用户ID作为参数
atm_board_deleted_acl.event
管理员
此捆绑包有自己的管理面板,可以查看所有用户及其板块的链接,这是管理面板的路由
{{ path('atm_board_admin_index')