Skip to content

Conversation

tomrss
Copy link

@tomrss tomrss commented Apr 2, 2025

Base information

Question Answer
Related to a SourceForge thead / Another PR / Combodo ticket? No
Type of change? Bug fix

Symptom (bug) / Objective (enhancement)

Unable to create a token (personal or application) with CRON scope needed to run /webservices/cron.php; the CRON option is missing in the UI.

This means that background tasks at /webservices/cron.php cannot be launched with token authentication.

Reproduction procedure (bug)

  1. On iTop 3.2.1
  2. With module in 3.2.1 bundle
  3. With PHP 8.3.12
  4. Create a personal token or an application token
  5. Add token scopes
  6. See that CRON scope is not listed
  7. Without this, we can't use token authentication for background tasks at /webservices/cron.php

Cause (bug)

Option simply missing from UI, but the CRON scope is handled in the code.

Proposed solution (bug and enhancement)

Add option to UI in order to be able to add CRON scope to token.

This PR adds the new value for the scope in the datamodel.
Other file modified are simply dictionary entries related.

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested all changes I made on an iTop instance
  • Would a unit test be relevant and have I added it?
  • Is the PR clear and detailed enough so anyone can understand digging in the code?

Checklist of things to do before PR is ready to merge

This PR contains also dictionary entries (made in the same way as previous ones) for the new CRON token scope.

'Class:PersonalToken/Attribute:scope/Value:Synchro' => 'Synchro~~',
'Class:PersonalToken/Attribute:scope/Value:Synchro+' => '/synchro/synchro_import.php and /synchro/synchro_exec.php~~',
'Class:PersonalToken/Attribute:scope/Value:CRON' => 'CRON~~',
'Class:PersonalToken/Attribute:scope/Value:CRON+' => '/webservices/cron.php~~',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can safely remove the ~~ from all the CRON+ dicts, as the path doesn't have translations 😉

Suggested change
'Class:PersonalToken/Attribute:scope/Value:CRON+' => '/webservices/cron.php~~',
'Class:PersonalToken/Attribute:scope/Value:CRON+' => '/webservices/cron.php',

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback @Hipska , I updated the translations

@odain-cbd odain-cbd self-requested a review April 2, 2025 09:48
Copy link
Contributor

@odain-cbd odain-cbd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! next step is to be able to trigger cron by http asynchronously. this is another story...

@jf-cbd jf-cbd moved this from First review needed to Pending functional review in Combodo PRs dashboard Apr 2, 2025
@jf-cbd jf-cbd moved this from Pending functional review to Pending technical review in Combodo PRs dashboard Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending technical review

Development

Successfully merging this pull request may close these issues.

3 participants