Unanticipated User Role setting causes error
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- php
- 領域
- authorization, backend
調査の方向性
CommentingPlugin::showComments から始め、views/public/comments.php と提案されている views/public/commentingHeader.php を比較します。コメントの表示と追加に関するロールチェックを追跡し、コメントは許可されているもののコメントの表示は許可されていないロールでも、エラーなしでラベル、フラッシュメッセージ、コメントフォームを引き続き受け取ることを確認します。
索引モデルが 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 はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 が 3167 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
omeka/plugin-Commenting#41 · 担当者 1 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
omeka/plugin-Commenting#26 · コメント 3 件 ·
omeka/plugin-Commenting の issue をすべて見る
似ている issue
-
Awaiting Triage
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
WordPress/two-factor#1008 ·
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
Перевод устарел
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 22 日以内に返信