list edited by a group of users

jubranz

New Member
Hi there,
I have a list and I want its records to be edited by super admins and a group of users. (not only one).
lets say that each record has data of a unique company, I want only the company's employees to be able to see and to edit their own company data.
I have a dropdown element that has the values of group ids. can I use that or is there another way?

thank you
 
Is your dropdown groups or access levels? Typically you would use access levels rather than groups for controlling access.

Either way there isn't a built-in way of doing this on a per-row basis, but it can be done with a pre-filter. Let me know if you want to use groups or access levels, and I'll give you an example.

-- hugh
 
Yes I am using a dropdown menu with groups ids, to directly assign user to a group while creating his profile for the first time with Juser plugin.
I was planning to use access level element but it shows all the access levels in Joomla.

so, yes I want to use groups.
 
Last edited:
OK, then a pre-filter like ...

WHERE
Field: group_id (raw) (or whatever your group ID field is called)
Condition: IN
Value: SELECT group_id FROM #__user_usergroup_map WHERE user_id = '{$my->id}'
Type: query
Apply to: Public (see note)

This should restrict access such that users can only see rows where the group_id value matches any of the groups they are a member of.

NOTE - if your Super Admins are not members of the individual company groups, you will need to create a new Access Level in J!, called something like "Not Super Admins", which includes everything except Public and the Super Admins group, so in a standard out-0f-box J! setup, that would be Guest, Manager and Registered. Then set the "Apply to" on that filter to that level, so the filter doesn't get applied to Super Admins.

-- hugh
 
great, I will give that a try..
one more thing please, Now I am sending a notification email to owner using the user element, what if I want to send an email notification to a group using an element that has group id.
.
 
You can use the "Email to (eval)" option, and a built in function we already use in the email plugin for getting emails from group ids ...

Code:
$myGroupId = (int)'{yourtable___group_id_raw}';
if (!empty($myGroupId)) {
   $myEmails = $this->getUsersInGroups(array($myGroupId), 'email');
   return implode(',', $myEmails);
}
return '';

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top