Page 1 of 1
categories and permissions
Posted: Wed Dec 06, 2006 9:17 am
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.
Re: categories and permissions
Posted: Wed Dec 06, 2006 10:35 am
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
Posted: Wed Dec 06, 2006 8:08 pm
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?
Posted: Wed Dec 06, 2006 8:53 pm
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
Posted: Fri Dec 08, 2006 10:44 am
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.
Posted: Fri Dec 08, 2006 2:17 pm
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