eZ Community » Forums » General » Content limitation - Best practice
expandshrink

Content limitation - Best practice

Content limitation - Best practice

Monday 24 May 2010 12:04:51 am - 4 replies

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? happy.gif Emoticon

Modified on Monday 24 May 2010 12:27:41 am by HÃ¥vard Bergersen

Monday 24 May 2010 10: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

Monday 24 May 2010 1:14:06 pm

Thank you so very much for your reply... happy.gif Emoticon

Monday 24 May 2010 3:39:57 pm

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?

Tuesday 25 May 2010 12:16:43 am

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.. blunk.gif Emoticon

So the placement has to be automated..

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu