Elxis CMS Forum

Support => Language => Topic started by: gooper on October 01, 2007, 13:21:21

Title: Restricting access to content in specific language
Post by: gooper on October 01, 2007, 13:21:21
Hi all,

I am new to Elxis. I have used Mambo and Joomla before, but due to language issues I am searching a new CMS. By the Way: congratiulation to the great work so far. :D

My problem is the following:
I have to build a new Intranet Website for different Countrys with different languages; no problem so far.
I would like to have diferent people to manager "their" content. They will have to have access only to the content items in their specific language.
I have tryed to do that with setting up a new user, reassign a content item to this user as Author, define a new group, assign the user to that group and giving the group the rights to "Login into Backend" and "Edit own content" in the Access manager.

But it it still possible to change all other content items. Maybe that i have made a misstake in this setup, but it seems that there is no possibility to restrict access to the menue structure.
If i understand this project (elxis) right, than that would be the reason due to the "multilanguage focus" instead of a "multiuser focus".
Please let me know.
Title: Re: Restricting access to content in specific language
Post by: datahell on October 01, 2007, 13:58:53
Access rights are something different than language settings although they co-work and affect what the final user see.

Unfortunately Elxis 2006.x has the problems of Mambo/Joomla here. You can not limit the sections/categories that the user has write access to. You can do this by the menu item but it is only a filter. A user by changing the section id in the URL can post in any section/category he/she wish. This has changed in Elxis 2008.x. In Elxis 2008.x you can set the specific sections/categories that users have access to write articles. Also there is a list of the latest 5 submitted articles and also a list of articles waiting for approval by the admin. Direct publish rights have been removed from Elxis 2008.x frontend.

But even this is not good for you. You need an even more specific distinction based on user groups and languages.
If I understood well you want users not to be able to create articles (you will have created from the back end I guess) but only to edit the ones (owned by them or all?) for their language. Right? We need a little core hacking here.

As users can change language we can not be based on the user selected language. We need to put users in specific groups based on language. So we create some groups in user's manager giving them permissions to edit OWN (or all? ) articles:

Author_english
Author_greek
Author_german
etc....

Elxis has already checked if user has edit abilities in general using:
$access->canEdit    = $acl->acl_check( 'action', 'edit', 'users', $my->usertype, 'content', 'all' );
$access->canEditOwn = $acl->acl_check( 'action', 'edit', 'users', $my->usertype, 'content', 'own' );

Now, we need to restrict the edit ability only to items for their language.
Here how we get user's group name:
$users_group = $acl->get_group_name($my->gid);

We will do a trick to check if user has edit access to an item:

$canEditItem = 0;
if (($access->canEdit || $access->canEditOwn) && (trim($row->language) != '')) {
   if (ereg('Author', $users_group)) {
      $ulang = split('_', $users_group);
      if (isset($ulang[2]) && ($ulang[2] != '')) {
         if (in_array($ulang[2], explode(',', $row->language))) {
            $canEditItem = 1;
         }
      }
   }
}

where $row->language is the article's language.
If the value of the $canEditItem variable is 1 user will be able to edit the article other way he wont be able to edit it.

This is a general guide you need afterwards to apply this kind of check everywhere in component content and also to filter/limit the available for edit sections and categories.

If you want, as GO UP Inc, we can create any customization you wish.

Title: Re: Restricting access to content in specific language
Post by: gooper on October 02, 2007, 18:50:22
@datahell:

maybe restricting with a filter would be enought for a start.
the Users are are inside my own company, so there will be very few problems with only having a "filter".
having to change anything in the URL will be to hard for them. Thats the reason for using a "simple" cms.

2008.0 will have an approval workflow, is that right?

correct me if I am wrong, but i think in 2008.0 will be all the features avaiable I need:
- Restrict users to work in specific section/category
- approval workflow
- different backend languages
- able to handle different frontend languages

Title: Re: Restricting access to content in specific language
Post by: datahell on October 02, 2007, 20:58:07
Add/Edit permissions have nothing to do with language. If you don't need maximum security (it's ok if by "mistake" someone post in wrong section/language) then you can do this:

- You don't need special groups!
- Create one section for each language.
- Create one menu item for each language for content addition. Add these menu items as link urls. Each one should has this link:
index.php?option=com_content&task=new&sectionid=xx&Itemid=yy
Where xx the section id for that language and yy the menu item's ID after clicking apply button.
Finish!

A logged in user will always see a "submit content" link that when clicked will drive him to post articles to the section that is for his current language! So, users having french language will post in "French section", user having spanish language will post to the "Spanish section" etc.

Users are already able to change backend and frontend language (since Elxis 2006.0). Yes Elxis 2008.x does not allow direct content publish from front-end anymore. Also does not allow content edit from front-end even for the super administrators! You are only allowed to edit an article while it is still in "waiting for aproval" status.