US0004 Add User to a Group - OpenScienceChain/OSC-IS_Doc GitHub Wiki

US Identifier US0004
Name Add User to a Group
Description As a PI of a research group, I would like to add users to different groups in my project, so that they can start performing transactions and reading data from the PDC and the Ledger.
Acceptance Criteria
1. * The PI or the person who will submit the addition of the User to the Group needs to have a special certificate. This certificate is provided by the Stewards of the OSC-IS network.
2. * When the PI invokes this functionality, the chaincode should look for his certificate. If said certificate doesn't exist, the PI can't add the User. If the certificate exists, it should have an attribute called "OU", with the "admin" value. If that is the case, the PI can continue with the addition of the user to a group. If not, an error message should be shown saying that the IP doesn't have enough privileges.
3. * Then, the chaincode needs to verify that the peer the PI is using matches the user's organization.
4. * The PI needs to use a "TransientMap" to pass arguments to this functionality.
5. * The PI needs to pass as arguments the following: Group Id (GID = OrgName.ProjectName.Group.Name)and APIUserID. The incoming transient map must have the form: {"GID": "UCSD.Nanomagnetism.Admin", "APIUserID": "[email protected]"}.
6. * The cc needs to verify that the user already exists. If the user doesn't exist yet, it should show an error stating that.
7. * The cc needs to verify if the group in the arguments list already has the user. If the group already has the user, the cc should show an error stating that.
8. * The group will update its User list, by adding the User struct associated with the argument APIUserID. The Group structure is updated in the PDC.
9. * The User will update its Group list, by adding the GID passed as argument. The User structure is updated in the PDC.
10. * The Project will update its group list by replacing the group with the new group containing the new user. The Project should keep its user list empty given that all the Users info in contained in the groups list.