Name |
Create a User in the Blockchain network |
Description |
As a PI of a research group, I would like to create a request to subscribe a new user in the Organization/Project, so that they can start performing transactions and reading data from the PDC and the Public Ledger. |
Aceptance Criteria |
|
1. |
* The PI or the person who will submit the creation of the User needs to have a special certificate. This certificate is provided by the Stewards of the OSC-IS network. |
2. |
* The chaincode needs to verify that the peer the PI is using matches the user's organization. |
3. |
* When the PI invokes this functionality, the chaincode should look for his certificate. If said certificate doesn't exist, the PI can't create any 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 creation of the User. If not, an error message should be shown saying that the PI doesn't have enough privileges. |
4. |
* The PI needs to use a "TransientMap" to pass arguments to this functionality. |
5. |
* In the TransientMap, the PI needs to pass as parameters the name of the Project, and the name of the group, and the APIUserID. APIUserID comes usually in the form of an email address: [email protected] |
6. |
* The incoming transient map should have the form: {"APIUserId":"[email protected]","Project":"Nanomagnetism","Group": "Admin"}. In this example, the user identified by the APIUserId [email protected] will be created and added to the Group Admin of the Nanomagnetism Project. The org name is implicit and is obtained with a simple function. |
7. |
* The chaincode needs to calculate a UUID for this user. This UUID will uniquely identify the new user and it is associated with the user's APIUserID. |
8. |
* Using this UUID, the cc needs to verify that the user doesn't exist in the PDC. If the user already exists, the cc should show an error saying this, and the program should exit. |
9. |
* Using the ProjectName and the groupName passed as parameters, the cc should verify that said group and project already exists. It should be enough with the verification of the Group's existence, given that a Group can't be created without an existing project. |
11. |
* Then, the chaincode creates a new User struct with the following attributes: |
|
1. UUID: UUID, As calculated previously. |
|
2. APIUserId: APIUserId, provided in transientMap |
|
3. Groups: [GID], a list containing the id of the initial Group of the new user. In this case, GID: "OrgName"."Project"."Group". In the example above, let's say the name of the organization is UCSD; then GID: UCSD.Nanomagnetism.Admin |
|
4. Projects: [PID], a list containing the id of the initial Project of the new user. In this case, PID: "OrgName"."Project". In the example above, let's say the name of the organization is UCSD; then PID: UCSD.Nanomagnetism. This configuration may allow a user to belong to different projects and groups within the organization. |
|
5. Org: Organization Name. In the example above, Org: UCSD. |
12. |
* This user struct then is submitted to the PDC of the Organization. The key id used to submit the user is its UUID. |
13. |
* Then we have to update the corresponding Group and Project structs. That means, in the Project struct, we need to add this user in the Users attribute, as well as in the Group. In the example above, the project UCSD.Nanomagnetism and the group UCSD.Nanomagnetism.Admin will have a new User added. |