sulu

No permission to webspace after changing webspace key


I am new to Sulu and trying to learn using it for a new project. After playling around a bit I wanted to change the platform key.

After that, the admin interface didn't show the Webspaces tab anymore.

I executed the commands

But nothing helped. After some debugging I found out that the new webspace was initialized, but my admin user did not get the new permissions.

Looking in the database I found some entries still related to the old webspace key in the se_permissions table:

id context module permissions idRoles
8 sulu.webspaces..default-snippets 127 1
9 sulu.webspaces. 127 1
10 sulu.webspaces..analytics 127 1
11 sulu.webspaces..custom-urls 127 1

Is there a way to automatically update the permissions? Is it a bug in Sulu?


Solution

  • This is not a bug. Renaming a "webspace key" will lose all your connected data to it. Including that your role have permissionf for it.

    Mostly a webspace key rename happens only on development.

    If you have no data to loose you can go with (attention remove all existing data in your configured database):

    bin/console sulu:build dev --destroy 
    

    Else a new or renamed webspace need to be added to your user role that you can see it. Go to Settings -> User Roles and give your role permissions for your new webspace / renamed webspace.

    Add Webspace permissions to your Role

    If you change a webspace key of a production website you would normally need to create database migrations. So you are not losing any pages, permissions, ... or other things connected to the webspace key.