processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

Non-superusers can't change hidden status of languages

Open adrianbj opened this issue 4 years ago • 12 comments

Short description of the issue

I know this isn't a common use case, but users with lang-edit can't change the hidden status of languages. They can see and change the unpublished status, but in my use case I want to set languages to hidden for a period of time before they become live - note that I am using them for controlling languages available for a frontend language selection field.

Expected behavior

Hidden checkbox is available on the Settings tab.

Actual behavior

It's not shown

adrianbj avatar Jul 10 '21 23:07 adrianbj

Isn't the problem with hiding languages that it will also make them disappear from the edit screen? So you can't start filling in the content before they become live either way.

daun avatar Jul 16 '21 10:07 daun

@daun - perhaps, but I don't have any multi-language fields anyway. I use the languages for triggering a runtime translation of an SMS message sent to the user. I am using the hidden status to remove it from a frontend form where the user edits their profile. I could do this other ways, eg add a new "hide" checkbox field to the language template, but I don't really understand if it's an intentional decision by @ryancramerdesign to make this unavailable for non-superusers, or a bug - seems like a bug to me.

adrianbj avatar Jul 16 '21 12:07 adrianbj

I agree it seems like a bug as far as expected vs. actual behavior go.

daun avatar Jul 16 '21 12:07 daun

@adrianbj does it help if the user has page-hide permission?

matjazpotocnik avatar Aug 17 '23 12:08 matjazpotocnik

@matjazpotocnik - I'm not sure, but the user has the page-edit permission and they can edit languages. Given that I don't have the page-hide permission installed, it should be delegated to page-edit (https://github.com/processwire/processwire/blob/6ff498f503db118d5b6c190b35bd937b38b80a77/wire/core/Permissions.php#L43) so I feel like that should work.

adrianbj avatar Aug 17 '23 17:08 adrianbj

I have a role editor1 with lang-edit and page-edit perms (I also don't have page-hide perm), and this user has the option to hide a language in the Settings tab:

image

I'm obviously missing something...

matjazpotocnik avatar Aug 17 '23 17:08 matjazpotocnik

Weird, in my case, the user has the lang-edit permission and this is what they see. I wonder if it might be because my users are on an alternate user template / parent page. That setup still seems to break things in various obscure ways.

image

adrianbj avatar Aug 17 '23 17:08 adrianbj

I tested with the user in an alternate branch, and it's working here... Can you test with the "regular" user first? Just to rule out "alternate" user issue?

matjazpotocnik avatar Aug 17 '23 18:08 matjazpotocnik

OK, on another install where all the users are regular, I actually see this where there are no status options to change.

image

adrianbj avatar Aug 17 '23 18:08 adrianbj

Ok, I'm out of ideas, I can't debug if I can't reproduce...

matjazpotocnik avatar Aug 17 '23 18:08 matjazpotocnik

For sanity's sake I just tested another install where initially no users had language editing permission. Gave it to them, and tested and I see the same empty Settings section again. These are all very different sites and I can't think of anything that would cause their behavior to be different to what you're seeing. Maybe Ryan has some thoughts?

adrianbj avatar Aug 17 '23 19:08 adrianbj

It must be something with roles/permissions... my test user has this permission in their role: page-view, page-edit, lang-edit, page-delete, page-move, profile-edit, tracy-debugger

matjazpotocnik avatar Aug 17 '23 19:08 matjazpotocnik