Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2021-04-09 11:13:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: [Solved] Writer authorization based on section?

Yay. Please let me know if there’s anything I’ve missed. In the meantime I’ll see if I can address those two known issues and then release this version officially.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#14 2021-04-09 12:17:53

SteveG
Member
Registered: 2020-08-04
Posts: 24

Re: [Solved] Writer authorization based on section?

Bloke wrote #329739:

Yay. Please let me know if there’s anything I’ve missed. In the meantime I’ll see if I can address those two known issues and then release this version officially.

Thanks for the work! And please fix smd_user_manager if you get time. That will make it a lot easier than go straight into SQL to create a new user group.

Offline

#15 2021-04-09 12:22:26

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: [Solved] Writer authorization based on section?

I’ll see what I can do about smd_user_manager. I made a start on fixing it ages ago and never got it finished.

Regarding the smd_section_roles plugin I’ve just patched the override form bug so that’s a step in the right direction.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#16 2021-04-09 13:00:42

SteveG
Member
Registered: 2020-08-04
Posts: 24

Re: [Solved] Writer authorization based on section?

Bloke wrote #329741:

Regarding the smd_section_roles plugin I’ve just patched the override form bug so that’s a step in the right direction.

This may break the section name shown in the editor. When a role only been assigned to one section, now it shows “Array” instead of the correct section name.

Last edited by SteveG (2021-04-09 13:00:57)

Offline

#17 2021-04-09 13:10:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: [Solved] Writer authorization based on section?

Drat. Good spot. Please hum some hold music for a few minutes.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#18 2021-04-09 13:21:30

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: [Solved] Writer authorization based on section?

Patched the patch. Hopefully that got it but I haven’t tested it on anything other than PHP 7.3 so I’m not sure if that syntax is globally valid. I’ll do some more tests later with varying versions to be sure.

EDIT: Seems to work in PHP 5.6 and 8.0 so I presume it’s okay. But there is a minor issue with the override forms list when using themes if you only permit a single section to be viewed. That’ll be because I’m using a hidden form element so I might have to switch to a select list and hide it with CSS.

EDIT 2: Nope, it’s to do with the default section. If you assign the default section to one that isn’t in the restricted set for the current user, Txp will choose the first one it can find in the original list and use that as the default. The plugin then comes along, strips that entry out and the override form isn’t updated to pick up the new set.

Last edited by Bloke (2021-04-09 14:07:43)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#19 2021-04-09 14:28:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: [Solved] Writer authorization based on section?

Heh, that was slightly more involved than I’d hoped. It’s more robust now and handles the situation where you set the default publishing section to one early in the list but your user is limited to using one of the later entries. It now correctly selects the hidden entry and refreshes the dropdown so the override_forms list is built correctly and respects the theme in force for that section.

Just one more bug to slay…


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#20 2021-04-09 15:04:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: [Solved] Writer authorization based on section?

Oki doke, all done. The latest version patches the hole regarding people cheating the dropdown values in the multi-edit tool when changing section. You’re now thrown a warning if you hack it. This feature, however, requires the upcoming Textpattern 4.8.6 as it contains a new callback that this plugin uses. Without that, the small hole in the plugin will still be there.

We’re intending to hurry 4.8.6 out as it fixes a regression in 4.8.5 – and as far as I’m concerned it’s stable enough to run on production servers anyway (I do!) but you didn’t hear that from me.

I’ll bundle up a full plugin release this afternoon.

EDIT: Released.

Last edited by Bloke (2021-04-09 15:15:07)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#21 2021-04-10 00:44:50

SteveG
Member
Registered: 2020-08-04
Posts: 24

Re: [Solved] Writer authorization based on section?

Nice!

Offline

Board footer

Powered by FluxBB