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

[Bug]: Admin cannot delete Translation Key #12166

Closed
dmaerzendorfer opened this issue May 19, 2022 · 8 comments · Fixed by #12369
Closed

[Bug]: Admin cannot delete Translation Key #12166

dmaerzendorfer opened this issue May 19, 2022 · 8 comments · Fixed by #12369
Assignees
Labels
Milestone

Comments

@dmaerzendorfer
Copy link

Expected behavior

A user with admin privileges can do everything. Including deleting Translation Keys.

Actual behavior

A user with admin privileges is not able to delete Translation Keys.

Steps to reproduce

adminTK.mp4

If a user has a role assigned which limits the access to the shared translation columns he is not able to delete keys.

After the user gets admin priviliges the does see all the translation columns, however he still cannot delete keys.

@antonio-masotti
Copy link

I don't quite get the problem:

  • your user is not an admin as the title here suggests
  • if the user has permissions over the translations, he can (at least in Pimcore 10.4.1 where I tested) delete the translations. This user is not an admin for example but has the permission to modify the translations:

image

In your case is not working - I suppose - because you didn't selected all the languages (French is missing). Now imagine you delete a translation key: if this user doesn't have permission for a given language, than it's totally fine that he cannot delete the key, otherwise he would also delete the translation for a language he's not supposed to be able to modify.

@dmaerzendorfer
Copy link
Author

dmaerzendorfer commented May 23, 2022

Yes, at first the user was not an admin.

I just gave him permissions to view German and English translations. This worked as intended, his view was limited and he could not delete any keys.

However, afterwards I gave the user admin privileges. Then the "shared Translations" Section in the user-settings also vanished (since its not needed, he sees everything anyway?). On logging in with the now admin user, he could also see all three Languages (German, English, French), just as intended.
Though, he still could not delete any Keys. Why is that? Apparently the user has the permission to see all languages? Why can't he delete keys then?

@robertSt7
Copy link
Contributor

I can't reproduce the bug.
Could you please provide more information or have a look into the debbuger?

@dmaerzendorfer
Copy link
Author

Have a look at the video, it includes all the steps.

However, here is a written guide to reproduce the bug:

  1. create a new role
    a) give this role "Translations" permissions
    b) limit the "Shared Translation Settings" to only one language (view+edit)
  2. create a new user
    a) assign the earlier role to the user and save it
    b) give the user admin privileges and save it again
  3. login as the user and check the translations. The user should now see all the languages but won't be able to delete any keys.

Hope this clarifies the scenario. What debugger info would help you in this case?

@robertSt7
Copy link
Contributor

robertSt7 commented May 24, 2022

When I do these 3 steps, I am able to delete keys.

if (this.domain === 'admin' || pimcore.settings.websiteLanguages.length == this.editableLanguages.length) { typesColumns.push({ xtype: 'actioncolumn', menuText: t('delete'), width: 30, items: [{ tooltip: t('delete'), icon: "/bundles/pimcoreadmin/img/flat-color-icons/delete.svg", handler: function (grid, rowIndex) { grid.getStore().removeAt(rowIndex); }.bind(this) }] }); }

Could you maybe try to debug these lines of code from https://github.com/pimcore/pimcore/blob/10.x/bundles/AdminBundle/Resources/public/js/pimcore/settings/translation.js#L306 ?

@dmaerzendorfer
Copy link
Author

Hey, so the project in which this bug originally occurred is Pimcore Version v10.2.9 so the Code for this differs a bit.

Here is what I found though:

if (pimcore.settings.websiteLanguages.length == this.editableLanguages.length || this.translationType === 'admin') { typesColumns.push({ xtype: 'actioncolumn', menuText: t('delete'), width: 30, items: [{ tooltip: t('delete'), icon: "/bundles/pimcoreadmin/img/flat-color-icons/delete.svg", handler: function (grid, rowIndex) { grid.getStore().removeAt(rowIndex); }.bind(this) }] }); }
pimcore.settings.websiteLanguages.length evaluates to 8; this.editableLanguages.length to 0;
this.translationType is 'website'

However, when I tested this on https://demo.pimcore.fun/admin (10.4.x-dev) I could recreate the bug.

@robertSt7
Copy link
Contributor

Hi, sorry, but I also can't reproduce the bug on the demo app. Maybe you can tell me what I do differently with this video:

2022_06_02_080743.mp4

@dmaerzendorfer
Copy link
Author

Hello there!

After watching your video and following your steps myself I noticed something. The Delete-Option is visible for the admin section of the Translations but not for the message section! Perhaps this has something to do with it?
image

@kingjia90 kingjia90 added this to the 10.4.3 milestone Jun 8, 2022
@kingjia90 kingjia90 linked a pull request Jun 8, 2022 that will close this issue
@mcop1 mcop1 closed this as completed Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants