categories and permissions

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
wagwag
Regular
Posts: 29
Joined: Fri Jun 16, 2006 7:56 am

categories and permissions

Post by wagwag »

Hi,
I am setting up a multi-user blog where each user has his own category and should be able to post only in his category.

I have setup the appropriate users, groups and categories and set their permissions. The problem is that every user can still create uncategorized entries. How can I prevent this so that users can post ONLY in their category?

Thanks.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: categories and permissions

Post by garvinhicking »

Hi!

You can install the plugin 'entrycheck' which allows you to set up Rules for Publishing, like that no posting in an unassociated category can happen.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
wagwag
Regular
Posts: 29
Joined: Fri Jun 16, 2006 7:56 am

Post by wagwag »

The plugin works great, thank you :)

Now I don't suppose there is a plugin to set the default category for new entries on a per-usergroup basis?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, I believe there is a plugin that deals with 'default categories', but I can't remember which one :)

But with a little bit of PHP code it would not be too hard to set that...if you remember me about it tomorrow I could try to come up with such a thing. But I'd only code that if you really need it ;)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
wagwag
Regular
Posts: 29
Joined: Fri Jun 16, 2006 7:56 am

Post by wagwag »

Well, I've actually been wanting to get into serendipity development, and this seemed like a good time to jump into the code.

I've had a look at the db structure and the code that makes the entry screen work, but I don't really see an intuitive way of assigning a default category for the group. Adding a default-category property to serendipity_groupconfig was my first thought, but those are mostly boolean values, which appear to be queried using the serendipity_checkPermission function. I could instead add a default-entry-category column to the serendipity_groups table but I'm not sure whether that is a good idea.

So now I ask, how would you do it?

As an aside, I did find a very simple and dirty solution to satisfy both my no-uncategorized-entries requirement, and my desire to default new entries to something besides [No Category]. By simply commenting out the 'No Category' from the category list in functions_entries_admin.inc.php, I prevent un-categorized entries, and get a default selected category in which the user has permission to post. :) However, I wouldn't be surprised if this dirty fix breaks something else.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Great, your eagerness should be awarded. :)

Let's see how I would do that: I would add the default posting category to the "personal preferences". That would simply add a "defaultcat" propery to the array that is defined in include/tpl/config_personal.inc.php.

That is then automatically assigned as $serendipity['defaultcat'] which you can use in the include/functions_entries_admin.inc.php entry form function.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply