Following the user/client/site relationship (#335254: associates users with clients in an autocomplete field), I would like to see this feature extended to support "types" of users. To quote a comment I made earlier in that issue:
[...] the relation between clients and users should be "qualified" There are different "types" of "users" that have access to the the "client". On the top of my head I can already think of those:
* tech
* billing
* ownerThose can be all the same person, but it's important to have different types of contact for the site so that we contact the right person for various issues (billing is very different from tech issues: the first will receive the bills, the second one maintenance announcements and the like).
I also think that users can have access to multiple clients too. So the relation is actually many to many, and typed. Note that this is also related to #336068: Confirmation e-mails should be sent to client users, not to the client email: that issue is an excellent example of use for the tech contact. The mail should be sent to the tech contact.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 371769_n-to-n.patch | 11.66 KB | anarcat |
| #21 | 371769_n-to-n.patch | 11.41 KB | anarcat |
| #17 | 371769_n-to-n.patch | 11.29 KB | anarcat |
| #16 | 371769_n-to-n.patch | 11.04 KB | anarcat |
| #10 | 371769_n-to-n.patch | 11.37 KB | anarcat |
Comments
Comment #1
mathieu commentedHere's a first patch - applies to today's version of hosting. Not sure of the last change to hosting_node_grants() .. needs to be tested some more.
Comment #2
anarcat commentedThings to improve:
* the SQL structure changes are only applied in the update_N functions and not in the basic schema
* there is one comment in french
Of course this is a work in progress, but just some things to keep in mind for now.
Comment #3
mathieu commentedComment #4
mathieu commentedRe-roll that fixes issues raised by anarcat.
Comment #5
mathieu commentedNew patch. Allows a user to select a specific client when creating a new site + prevents "devel.module" from breaking the ajax output.
Comment #6
anarcat commentedThis will need to be ported since I committed a fix for #442262: access controls broken for site creation in client. Please review.
Comment #7
anarcat commentedPatch rerolled. From my testing, a few things are still missing/broken:
* submitting the user edit form only keeps the last user selected
* no place to set the relation type (not a problem, but if we don't allow changing it, we shouldn't show it either)
* nothing in the client edition form
* paging?
* when logged into a user that only has 'aegir client' and access to a single client, i get this:
Otherwise access controls seem to work. Of all those problems only the first and the last are real problems right now.
Comment #8
anarcat commentedForgot the file.
Comment #9
anarcat commentedSo I worked around a lot of those issues. We still have to fix this:
* no place to set the relation type (not a problem, but if we don't allow changing it, we shouldn't show it either)
* nothing in the client edition form
* paging?
But this is already useable. I would think it ready for testing.
Note that I remove the call to hook_user_submit() in insert/update because it was called twice (that may not be obvious in the patch...)
Comment #10
anarcat commentedFix client creation with automatic user creation.
Add code to allow setting the relationship type.
Comment #11
anarcat commentedThe new user creation form barfs on the hosting_client field not being set, that's rather annoying...
Comment #12
anarcat commented... and the signup form is broken by the patch: "Please fill in a valid client".
Comment #13
adrian commentedThis is good code, but I feel it's a bit late in the game to commit this now, especially as this deeply deeply complicates the access permissions.
We'll get this in at the beginning of the 0.3 timeline
Comment #14
adrian commentedI can see it going in without the different access levels.
We just also need an interface for listing the users for each client.
Possibly we also need a permission to allow them to create new users for themselves too =\
Comment #15
adrian commentedI don't want to see us focussing too much effort on this, since clients are (for now) still an experimental feature.
Comment #16
anarcat commentedSo. I've rerolled the patch without the UI for 'type' edition. The remaining issues before this hits head:
* fix the signup form
* fix the user creation form
After that, the things that would also be nice to get into the tree:
* list/edit users in clients
* permission for users to create new users for a client
* this goes in pair with an 'edit own clients' permission that would allow users to control the ACL for their clients (as opposed to administer clients, which lets you control any client)
If we commit this, we go beta. If we don't, we go RC.
Comment #17
anarcat commentedHere's a reroll that fixes the two critical issues. I think this is ready for a commit.
Comment #18
anarcat commentedA test routine i described on IRC:
Comment #19
accreate -> site gives this:
going to the client page of a new client and pressing the add site tab results in the new site being owned by UID1 client rather than the new client whose node you pressed 'add site' tab on
Comment #20
acIf you actually try push on past the error above then you get this error on submission of the site creation form:
Comment #21
anarcat commentedacbot found a few issues with the patch, which should be fixed by this new reroll.
Comment #22
anarcat commentedRerolling the patch. This fixes issues with permissions for the admin user, re-enables the 'create site for client X' shortcut and allows the admin to properly bypass access checks for users.
Comment #23
anarcat commentedI have committed another version of the latest patch, after extensive testing by acbot.
I'm heading for a beta now. The remaining issues here will be raised in other issues.
Comment #24
anarcat commentedThose extra features: #461840: type client/user relationships, #461836: allow users to edit client ACLs for their own clients and create users for their clients and #461834: allow list and edit of users in client nodes.