django-unfold icon indicating copy to clipboard operation
django-unfold copied to clipboard

Problem with Unfold sidebar permissions

Open jverdasca opened this issue 10 months ago • 1 comments

When logging in with a user with fewer permissions, the sidebar items disappear and when logging in with a user with more permissions, these items are not reset, that is, the items shown in the sidebar to the user with more permissions remain the same as those shown to the user with fewer permissions.

The problem is that the way unfold handles permissions changes the settings dictionary defined in the Django settings in the UNFOLD variable.

The problem occurs here and the Django settings are changed here, thus changing the UNFOLD settings variable due to the reference in navigation variable. A solution to this problem is to use deepcopy from Python's copy module (documentation here), which ensures that settings.UNFOLD remains in its original state and navigation variable contains a copy of UNFOLD setting.

Using deepcopy as I demonstrate below solves the problem described

imagem

Edit: I am using the SIDEBAR settings the same way as described in here

jverdasca avatar Apr 10 '24 11:04 jverdasca

@jverdasca you are probably using old unfold version. This issue has been fixed in some of the recent release

summerthe avatar Apr 12 '24 20:04 summerthe

Yes, this one is supposed to be fixed. I'm closing this issue.

lukasvinclav avatar May 03 '24 17:05 lukasvinclav