US0006 Create a Project - OpenScienceChain/OSC-IS_Doc GitHub Wiki

US Identifier US0001
Name Create a Project
Description As a PI of a research group, I want to be able to create or initialize a project in the network so my group and I can start submitting data to the ledger
Acceptance Criteria
1. * The PI or the person who will submit the creation of the Project to the network 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 create any project. If the certificate exists, it should have an attribute called "OU", with the "admin" value. If that is the case, the user can continue with the creation of the project. If not, an error message should be shown saying that the user doesn't have enough privileges.
3. * Then, the chaincode needs to verify that the peer the user is using matches the user's organization.
4. * The user needs to use a "TransientMap" to pass arguments to this functionality.
5. * The user needs to pass as parameters the name of the Project twice. This can be arrange through an API, so that the incomig transient map has the form: {\"GroupName\":\"OSC-IS_PROJECT\",\"ProjectName\":\"OSC-IS_PROJECT\"}. When a user provides such arguments, the chaincode should know that the user intends to create a Project, not a group.
6. * The chaincode should verify that the project doesn't exist yet. If a project already exists, the chaincode should throw an error saying this.
7. * If all the above verification passes, the chaincode will create a new Project with the name passed as parameter twice. Since a project is created as a group, the chaincode needs to set the following attributes:
1. GUI: OrgName.ProjectName.ProjectName
2. Project: OrgName.ProjectName
3. GroupName: GroupName (As passed as paramater. In the example above, GroupName = "OSC-IS_PROJECT")
4. Users: Empty Users array
5. Groups: Empty Groups array
6. Org: OrgName. Orgname needs to be obtained inside this fucntion.
8. * Once the project is created, the project needs to be stored in the PDC of the Organization with the correct namespace so that it is unique in the network.