Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bin/plugin.php doesn't suppor $auth object #4422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
solewniczak opened this issue Mar 21, 2025 · 2 comments
Open

bin/plugin.php doesn't suppor $auth object #4422

solewniczak opened this issue Mar 21, 2025 · 2 comments

Comments

@solewniczak
Copy link
Contributor

The problem

bin/plugin.php defines the constant: 12:define('NOSESSION', 1);. This prevents the inc/init.php from running 238:auth_setup() function. In the results the $auth global variable is not initialized. However, some plugins that uses cli components relies on that object. For example notification uses it in 170:helper.cron.php to get the e-mail addresses for users to send them notifications.

There probably are reasons for not initializing the $auth variable in the cli components. However, I think that there should be some method to get the users data inside cli components.

Version of DokuWiki

2024-02-06a "Kaos"

PHP Version

8.2

Webserver and version of webserver

No response

Browser and version of browser, operating system running browser

No response

Additional environment information

No response

Relevant logs and/or error messages


@splitbrain
Copy link
Collaborator

Yeah this bit me a couple of times in the past, so I appreciate you opening this issue.

For now I always worked around by explicitly calling auth_setup() in my CLI.

However, I am unsure what the correct approach would be. Some thoughts:

  1. not all auth backends are suitable to be used when running on the command line (eg. oauth)
  2. a CLI plugin is basically admin, since it can do what ever it wants on the file system, but it is not really authed as admin
  3. a CLI plugin might still want to check ACLs, for example to only work on public info,
  4. a CLI plugin might want to work as a certain user, but that might not always be possible because of 1.

Suggestions on how to approach this welcome.

@splitbrain
Copy link
Collaborator

duplicate of #2823

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants