Prefilter by Assigned Element / Group

jsnider

Member
I have reviewed a bunch of posts and have gained some insight, but not enough to have clear direction.

I need to be able to assign viewability / editing for users by different projects. I have a list / table with records in it, each of which is assigned a project. I need to be able to have multiple users login and be able to see only the project records that are assigned to them.

Example -
Project A - assigned to users 1, 2, 3
Project B - assigned to users 4,5,6
Project C - assigned to users 6 and 7.
Project D - assigned to users 5, 8, and 9 etc...

Then prefilter limits all records so users 1,2,3 can only see / edit Project A records.

I have been able to do this in the past for individual users using a userid field, but I have had to add the ids manually because users aren't creating their own records? I could add multiple users into the userid field, but again that is manual and I need something where I can just create a group with the project definition, and then assign the user ids to that?
 
OK, I made some progress on this in a round about way. There is probably a better way by prefiltering on a group, BUT I was able to assign user IDs in one table, autofill these in records in a different table, and then use the individual myid prefilter upon login. It is not very graceful but it seems to work. That way I can also pre-sort on my database dropdown join by the same myid and people only have the option of adding records for projects assigned to them.
 
Hi All -

Not sure the user group element totally works, but came close. I need to be able to log in and create records for different parties, and this seems to record the current users groups - which means if I am admin or have access to all the groups, then it would make the records accessible to everyone. This would work well if users in groups are the only ones creating their own records.

My solution:

Create a group with a COMPANY name in the Joomla Users admin. Assign users to a COMPANY.

In the PROJECTS table, assign projects to a COMPANY, but use the joomla group id for the company, not the company name.

In the other table, create a field for company that is autofilled with the company's ID field from the PROJECTS table. Have this autofilled in the new table, when a project is selected.

Now the new table has a field with company's ID assigned to each record.

Then create a pre-filter for the new table WHERE company IN {$my->groups} Text Registered. This looks at that company field, finds the ID and crossrefs with the users group IDs. If they match up, those records are shown. If they don't, then nothing is shown.

Once implemented, I basically just assign a user to a company once in Joomla Users, and assign a project to a company once in my PROJECTS table.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top