Content limitation - Best practice

Author Message

Håvard Bergersen

Sunday 23 May 2010 3:04:51 pm

Hello Everyone.

I have intranet type of solution that I am working on, and i was wondering if anybody has some advice to offer abour this "problem":

I have a 'news' section on the frontpage, where all users can add news.

When they add a 'news' they are supposed to be able to select which users the 'news' can be available to.

So they add a new 'news' and select from 2 drop down lists:
- Department a / b / c / all
- Section x / y / z

So when a user from department b logges in, he ca see the news that have selected department b, and all.
Section is depending on department, but the section value will be the same for all deparments, so this simplify things a little bit. The matching will not be that complicated.

What is the best way to achieve this?
One solution of course is llimiting the foreach, but that is a heavy way to do it (?)

{def $news=fetch ('content', 'list', hash('parent_node_id', 173 etc...}

{foreach $news as $n}
 {if the 'department' matched the users 'department' or 'all' )}
 {if the 'section' has been selected and matches the users 'section'}
  {...}
 {/if}
 {/if}
{/foreach}

Another solution is to use the ezpublish's user limitationn.. Then I would have to create one usergroup and section for each 'department' etc etc...
Then i would also have to edit the register view, so that the users are put in the usergroup that matches the department they have selected ect...

Suggestions? :)

Ivo Lukac

Monday 24 May 2010 1:28:31 am

Hi Havard,

You can of course do all the logic in the templates but this is not the way to do it.

IMHO the best way would be to set up user groups according to departments and give them specific rights. I would use object states to distinguish between Departments and Sections. The only problem is with user/register which should be tweaked so user can choose user group where he wants (by default user group is defined in ini per siteaccess).

Doing it this way you will have clear and easy management of user rights through administration interface. You can easy expand policies and manage Departments and Sections.

Cheers

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Håvard Bergersen

Monday 24 May 2010 4:14:06 am

Thank you so very much for your reply... :)

Luc Chase

Monday 24 May 2010 6:39:57 am

Strongly agree with Ivo. Also remember that user-groups can be nested. Do you really need to automate the placement of new users into a group?

The Web Application Service Provider

Håvard Bergersen

Monday 24 May 2010 3:16:43 pm

Yes and no... For this particular project I don't..

But the idea is to make this system a "prototype" because I want to take this consept (that a customer is paying me to develop) and re-sell it.. ;)

So the placement has to be automated..

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.