Can't add credit to ticket

Open Beginner friendly
#256 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php

Research direction

Start in ticket.form.php around line 62 and compare its entity check with the corresponding check in ticket.php. Reproduce adding credit to a ticket with the reported GLPI and plugin versions, then verify that authorized users can add credit while unauthorized users remain denied.

Written by the indexing model from the issue text.

Description

Code of Conduct
  • I agree to follow this project's Code of Conduct
Is there an existing issue for this?
  • I have searched the existing issues
GLPI Version

11.0.6

Plugin version

1.15.7

Bug description

Hi

I have an AccessDeniedHttpException when trying to add credit to a ticket, even with Super-Admin profile.
Bug is there since 1.15.5.

I think the problem is in ticket.form.php, line 62 (for 1.15.7) as the variable passed to Session::haveAccessToEntity should be the entity id of GLPI and not the voucher id.

if (!Session::haveAccessToEntity($_REQUEST['plugin_credit_entities_id'])) {
    throw new AccessDeniedHttpException();
}

$_REQUEST['plugin_credit_entities_id'] contains plugin_credit_entities table "id" field and not "entities_id" field

If I remove this test, everything works.

The entity test in ticket.php is checking the correct field.

Best regards,

Relevant log output

Page URL

No response

Steps To reproduce
  1. Try to add credit to a ticket
Your GLPI setup information

No response

Anything else?

No response

Dominant language
PHP
Stars
16
Forks
25
Avg merge
12h 47m
Merged PRs (30d)
8

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.