Jump to content

Missing adminpermissions


BlindPilot

Recommended Posts

Hi Guys,

i think i made a mystake. Change the role of my first user.

I.ve activated Adminpanel and all the checkboxes after creating a new role. But now when i.m logged in into the website i can.t select "admin" only "Profile" and "log out".

Is there a chance to set back the role or have i to make a complete new installation?

Thanks for Help.

Link to comment
Share on other sites

There's a thousand ways to do this, but this would be easiest to explain:

1. Go to this file and after this line

https://github.com/nabeelio/phpvms/blob/dev/app/Http/Controllers/Frontend/HomeController.php#L16

 

Put this

User::find(1)->attachRole('admin');

2. Go to your home page (http://siteurl.com/) and refresh the page and it should be there again.

3. Remove the line of code

This is assuming you are User number 1 in your database (id of 1 in the users table). There are other ways to do it such as putting it in the routes file, editing the database tables (but not recommended as it adds it into a few), using the Auth::user() instead once you are logged in.

  • Thanks 1
Link to comment
Share on other sites

11 hours ago, web541 said:

There's a thousand ways to do this, but this would be easiest to explain:

1. Go to this file and after this line

https://github.com/nabeelio/phpvms/blob/dev/app/Http/Controllers/Frontend/HomeController.php#L16

 

Put this


User::find(1)->attachRole('admin');

2. Go to your home page (http://siteurl.com/) and refresh the page and it should be there again.

3. Remove the line of code

This is assuming you are User number 1 in your database (id of 1 in the users table). There are other ways to do it such as putting it in the routes file, editing the database tables (but not recommended as it adds it into a few), using the Auth::user() instead once you are logged in.

Thanks i.m now back in :)

Link to comment
Share on other sites

  • Administrators
On 4/17/2020 at 11:17 AM, BlindPilot said:

Hi Guys,

i think i made a mystake. Change the role of my first user.

I.ve activated Adminpanel and all the checkboxes after creating a new role. But now when i.m logged in into the website i can.t select "admin" only "Profile" and "log out".

Is there a chance to set back the role or have i to make a complete new installation?

Thanks for Help.

 

You changed the role for your own user away from admin? I need to block that from happening...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...