I have some custom tables in my ModX database containing a list of data which needs to be returned selectively according to the resource group of the logged in user. Previously the resource group ID's in modX matched those in the custom tables so I simply catered did a comparison in my SELECT statement, however the client has changed the scope of the plugin and resource group ID's do not match any ID info in the tables.
To further complicate matters there is a many to many relationship in the actual tables, with clientID's requiring access to multiple branchID's.
I know my way around xPDO and could write a custom snippet to return the data but that would involve a lot of work on my part and the snippet would need amending on a regular basis as clients and branches changes.
I'm at a bit of a loss as to how to proceed at the moment, the client has expressed a preference for additional fields to be added to the resource group creation form so he can manually enter the client and branch id's, but that sounds like a massively complicated way of doing things.
Has anyone got any ideas about how to accomplish this in the most effective way? Preferably with a package and template variables but I'm open to any ideas.
Sorry for the oblique question but thats pretty much all the info I have as well:)
-
☆ A M B ☆
- 24,524 Posts
My first reaction is to use MIGXdb and create a CMP for this, but beyond that I don't see the way clearly.
Or possibly ClientConfig might be useful?
Indeed, the main problem is that the data in the tables doesn't match up with the Modx Resource groups, that would simplify things massively but due to the crossovers between client and branch relationships I don't think it's viable any longer.
I'll look into MigXDB and CMP's as well as ClientConfig, thanks for the pointers.
I have some custom tables in my ModX database containing a list of data which needs to be returned selectively according to the resource group of the logged in user. Previously the resource group ID's in modX matched those in the custom tables so I simply catered did a comparison in my SELECT statement, however the client has changed the scope of the plugin and resource group ID's do not match any ID info in the tables.
To further complicate matters there is a many to many relationship in the actual tables, with clientID's requiring access to multiple branchID's.
how does this relationships look like then?
Any xpdo-schema, you can show?
Unfortunately not Bruno, this thing is in the planning stage atm, I have an example of what the tables will look like so I'll put something together and post it here.
I'm not sure if it will help, but you can find out if the current user is a member of a particular User Group (or an array of groups) with
if ($modx->user->isMember('SomeGroup')) {
}
AFAIK, there is no event for OnUserGroupFormPrerender, which means there's no easy way to modify the User Group form.
http://bobsguides.com/modx-revolution-events.html
It is possible to modify the Create/Update User form, however, and it might make sense to extend the modUser object with the ClassExtender extra to store data for individual users that might help with the task.