Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-04-22 20:54:21
- janvi
- Member
- From: Norway
- Registered: 2009-05-28
- Posts: 41
Limit users post access to 2 sections only
Hey.
How can I restrict posting access to my contributors to only 2 sections.
I need to prevent my users from posting in my static sections. My plan was to allow article posting in 2 sections only. How can I remove their access to the remaining sections?
I’ve already tried with the bot_write_tab_customize plugin. This’s working well, but hides the rest of the sections for me too.
All suggestions will be mucho’ appreciated.
-janvi
Imagine a world in which every single person on the planet is given free access to the sum of all human knowledge.
The Future is Open – GNU/Linux
Offline
Re: Limit users post access to 2 sections only
janvi wrote:
I’ve already tried with the bot_write_tab_customize plugin. This’s working well, but hides the rest of the sections for me too.
Yea, but you can still go to the “Articles” tab,
mark an article, scroll down to the bottom “With Selected:” selectbox,
and then change the section of it.
So you now publish an article to a wrong section with the “Hidden” status,
and then going to the “Articles tab” and move it to the right section + change the status to “Live”.
Last edited by THE BLUE DRAGON (2010-04-22 21:05:24)
Offline
Re: Limit users post access to 2 sections only
There’s probably a way to create a plugin that modifies sec_section_list and pluggable_ui() Callback Events. Unfortunately, that’s about all the help I can be.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: Limit users post access to 2 sections only
You can also just change the Privileges of the plugin to be working only for “Managing Editor”
so then you (Publisher) will get the regular Write tab,
but your users (Managing Editor) will get the one that been customized with the plugin.
And if the regular “Managing Editor” Privilege not enough for your users,
go and install the bot_privs plugin and then edit the “Managing Editor” Privilege for your users needs.
Offline
Re: Limit users post access to 2 sections only
Ok I lied. I’ve got a rough plugin created that does this on the write tab but I’m having trouble figuring out how it works on the article list tab.
If you want to start with this and run with it that’s fine by me. If anyone wants it let me know
Last edited by MattD (2010-04-23 20:48:28)
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#6 2010-04-22 23:40:40
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: Limit users post access to 2 sections only
I haven’t tried Matt’s plugin – which is probably the right choice if you need only to hide sections – but I’d go this way:
1) hide sections with bot_write_tab_customize
2) as Gil suggest slightly modify plugins code to add privileges for all levels but publisher
3) optionally – if you are really paranoid about this – you can set “User can edit only his files” through bot_privs and use the asv_auth_articles plugin to only show user articles in the “articles” tab.
Offline
Re: Limit users post access to 2 sections only
MattD
There’s no callback on the list page yet. It’s a known omission, primarily because adding one may impact the article/filtered counts if a plugin such as yours omitted certain records during the list generation — the counts/pagination are currently calculated before the list is generated, so by the time a callback fires it’s too late.
I had a stab at a different approach to allow you to alter the actual query that’s used on the page. It works in 98% of cases I tested (but check the addendum post) so is a possible candidate for inclusion, though it could probably be implemented better. If you have any ideas on a suitable place for / the nature of a callback in this tab, then please make your case.
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
Re: Limit users post access to 2 sections only
This is one of those cases where I’d really like to see some Drupal like privileges available for Textpattern. Textpattern’s current user roles can be a little restrictive at times.
Offline
Re: Limit users post access to 2 sections only
Thanks Stef, in this case we’d need to alter the query that builds the section options when mass editing articles. Not the query that creates the list. That is if I’m understanding the request correctly.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#10 2010-04-23 20:02:44
- janvi
- Member
- From: Norway
- Registered: 2009-05-28
- Posts: 41
Re: Limit users post access to 2 sections only
Thank you. I think I’ll go for an ‘in-between-solution’.
Plugins used:- asv_auth_articles
- bot_privs
- bot_write_tab_customize
To achieve what I want in -terms of user access to my limited sections, a little hack had to be performed.
edited /textpattern/include/txp_list.php (line 360)
function list_multiedit_form($page, $sort, $dir, $crit, $search_method)
{
$methods = array(
// 'changesection' => gTxt('changesection'),
'changecategory1' => gTxt('changecategory1'),
'changecategory2' => gTxt('changecategory2'),
'changestatus' => gTxt('changestatus'),
'changecomments' => gTxt('changecomments'),
// 'changeauthor' => gTxt('changeauthor'),
// 'delete' => gTxt('delete'),
);
Result: Static pages-hidden in ‘public’ section. Change section and status in phpmyadmin or via CLI
All sorted now. Thanx again.
-janvi
Last edited by janvi (2010-04-23 20:17:50)
Imagine a world in which every single person on the planet is given free access to the sum of all human knowledge.
The Future is Open – GNU/Linux
Offline
Re: Limit users post access to 2 sections only
MattD
Crap, you’re right I misread the OP, sorry.
All
As fortune would have it, in the past few weeks I’ve been experimenting with a few ideas in TXP:
- Move the roles/privs into the database instead of being defined in an external file
- Allow a plugin to extend/alter the multi-edit capabilities on the list pages
After several failed attempts at #1 I formulated a plan which I’ve mislaid somewhere (I’ll find it) that I think worked. Putting user privs in the DB would require a query or two extra up-front which does slow TXP a tiny bit so I’m hesitant to do it, despite the benefits. I’d have to run it by the other devs and see if it was something that was workable.
That’s only one approach of course; another way would be an ‘official’, optional user-privs-file that could be created in a defined place in your TXP install if you wished. That would follow the same format as the current file but would allow you to officially alter/extend the roles & privs without touching core files. Downside: it’s outside the DB and open to abuse/support calls if someone alters the built-in permissions. Might be a TXP 5 decision.
I also failed at #2 last week (I’m not very good, am I!) while I was mucking about with a plugin that could really benefit from the ability to use TXP’s multi-edit system. As it turned out I had to write my own version that pretty much copied the way TXP did things, which was a shame.
I have a hunch that the multi-edit thing needs a subtle alteration or three before it can be made accessible to other plugins via a callback. If I figure it out I’ll do it because it’d be great to be able to alter the with-selected list and/or add your own multi-edit capabilities to your plugin tabs without making your own system that mimics TXP’s.
Last edited by Bloke (2010-04-25 15:36:01)
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
Re: Limit users post access to 2 sections only
janvi wrote:
Thank you. I think I’ll go for an ‘in-between-solution’ Plugins used:
- asv_auth_articles
- bot_privs
- bot_write_tab_customize
To achieve what I want in -terms of user access to my limited sections, a little hack had to be performed.
edited /textpattern/include/txp_list.php (line 360)
bc. function list_multiedit_form($page, $sort, $dir, $crit, $search_method) { $methods = array( // ‘changesection’ => gTxt(‘changesection’), ‘changecategory1’ => gTxt(‘changecategory1’), ‘changecategory2’ => gTxt(‘changecategory2’), ‘changestatus’ => gTxt(‘changestatus’), ‘changecomments’ => gTxt(‘changecomments’), // ‘changeauthor’ => gTxt(‘changeauthor’), // ‘delete’ => gTxt(‘delete’), );
Result: Static pages-hidden in ‘public’ section. Change section and status in phpmyadmin or via CLI
All sorted now. Thanx again.
-janvi
I don’t understand, how to use this for hide different sections from different users? (i want to create a multiblog)
Pls help!(
Last edited by Katalonian (2010-05-27 10:33:36)
<txp:txp_me />
Offline