Unanticipated User Role setting causes error
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 38/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- php
- Domaine
- authorization, backend
Piste de recherche
Commencez dans CommentingPlugin::showComments et comparez views/public/comments.php avec le fichier proposé views/public/commentingHeader.php. Suivez les vérifications de rôles pour l’affichage et l’ajout de commentaires, puis vérifiez qu’un rôle autorisé à commenter, mais pas à voir les commentaires, reçoit toujours le label, le message flash et le formulaire de commentaire sans erreur.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- PHP
- Étoiles
- 4
- Forks
- 5
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de omeka/plugin-Commenting
-
Rearrange config Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 42/100
omeka/plugin-Commenting#59 ·
-
Recaptcha link doesn't work Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 45/100
omeka/plugin-Commenting#58 ·
-
User role issues Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
omeka/plugin-Commenting#57 ·
-
omeka/plugin-Commenting#41 · 1 personne assignée ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 20/100
omeka/plugin-Commenting#26 · 3 commentaires ·
Toutes les issues de omeka/plugin-Commenting
Issues similaires
-
sync-en
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
sync-en
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
-
Перевод устарел
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
bug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
az-digital/az_quickstart#6047 ·
-
Error when saving email Ouvertebug needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100