Skip to content
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

Error When Printing Current User in CakePHP and Restricting Toolbar Access #63

Open
ahmd3adel opened this issue Jul 20, 2024 · 0 comments

Comments

@ahmd3adel
Copy link

I'm encountering an issue in my CakePHP application when trying to print the current user. I'm using the following code:
$user = $this->Auth->user();
debug($this->Auth->user());

However, this results in a 500 Internal Server Error with the following message:

/cake4/rd_cake/permanent-users/menu-for-grid.json
500 Internal Server Error
Call to a member function user() on null

generally i want to prevent any user except root to show the toolbar where create permenant suer

It appears that $this->Auth is not properly initialized or is null, causing the user() function to fail.
how can i solve this issue

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

No branches or pull requests

1 participant