Unanticipated User Role setting causes error
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- php
- 领域
- authorization, backend
调研方向
从 CommentingPlugin::showComments 开始,将 views/public/comments.php 与提议的 views/public/commentingHeader.php 进行比较。跟踪查看和添加评论的角色检查,然后验证允许发表评论但不允许查看评论的角色仍能在不发生错误的情况下收到标签、flash 消息和评论表单。
由索引模型根据 Issue 内容生成。
描述
I came across an issue which gets triggered by the scenario that a certain User Role is able to make a comment, but not allowed to view them. In this case the $view variable along with $view->addHelperPath is not set since this is currently dependent on the ability to view comments. Also in this scenario the Label as well as the flash message does not get output, since they currently reside in views/public/comments.php, which gets bypassed.
To fix the issue, I updated the showComments function in CommentingPlugin to the following:
public static function showComments($args = array())
{
echo "<div id='comments-container'>";
// presume we will need the view in any case
if(isset($args['view'])) {
$view = $args['view'];
} else {
$view = get_view();
}
$view->addHelperPath(COMMENTING_PLUGIN_DIR . '/helpers', 'Commenting_View_Helper_');
// output the header
echo $view->partial('commentingHeader.php');
if( (get_option('commenting_allow_public') == 1)
|| (get_option('commenting_allow_public_view') == 1)
|| is_allowed('Commenting_Comment', 'show') ) {
$options = array('threaded'=> get_option('commenting_threaded'), 'approved'=>true);
$comments = isset($args['comments']) ? $args['comments'] : $view->getComments($options);
echo $view->partial('comments.php', array('comments'=>$comments, 'threaded'=>$options['threaded']));
}
if( (get_option('commenting_allow_public') == 1)
|| is_allowed('Commenting_Comment', 'add') ) {
echo "<div id='comment-main-container'>";
echo $view->getCommentForm();
echo "</div>";
}
echo "</div>";
}
This presumes that we need the $views set in any case.
I also created a new file views/public/commentingHeader.php which contains:
<?php $label = get_option('commenting_comments_label'); ?>
<?php if ($label == ''):?>
<h2><?php echo __('Comments'); ?></h2>
<?php else: ?>
<h2><?php echo $label; ?></h2>
<?php endif; ?>
<div id='comments-flash'><?php echo flash(true); ?></div>
This code has been removed from views/public/comments.php.
- 主要语言
- PHP
- 星标
- 4
- 派生
- 5
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
omeka/plugin-Commenting 的其他 Issue
-
Rearrange config未关闭
难度 3/5 1-2 天 新手友好度 42/100
omeka/plugin-Commenting#59 ·
-
难度 1/5 1 小时以内 新手友好度 45/100
omeka/plugin-Commenting#58 ·
-
User role issues未关闭
难度 4/5 3-5 天 新手友好度 35/100
omeka/plugin-Commenting#57 ·
-
Comment div bumps prev/next nav inappropriately可能重新可做 @patrickmj 于 3164 天前认领,目前没有进行中的 PR。 未关闭
omeka/plugin-Commenting#41 · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 20/100
omeka/plugin-Commenting#26 · 3 条评论 ·
查看 omeka/plugin-Commenting 的全部 Issue
相似的 Issue
-
[Type] Bug
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
coollabsio/coolify#12016 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
woocommerce/woocommerce-gateway-stripe#6008 ·
维护者通常 1 天内回复
-
product / auth product / databases product / sites product / vcs
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
backend enhancement good first issue php
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复