@@ -64,11 +64,8 @@ curl -k -XPOST -H "Content-Type: application/json" https://localhost:5000/api/re
64
64
},
65
65
"identifiers": [
66
66
{
67
- "identifier": "10.9999/rdm.9999999 ",
67
+ "identifier": "10.9999/rdm.0 ",
68
68
"scheme": "DOI"
69
- }, {
70
- "identifier": "9999.99999",
71
- "scheme": "arXiv"
72
69
}
73
70
],
74
71
"creators": [
@@ -79,7 +76,7 @@ curl -k -XPOST -H "Content-Type: application/json" https://localhost:5000/api/re
79
76
"family_name": "Brutus",
80
77
"identifiers": [
81
78
{
82
- "identifier": "9999-9999-9999-9999 ",
79
+ "identifier": "9999-9999-9999-9990 ",
83
80
"scheme": "Orcid"
84
81
}
85
82
],
@@ -101,7 +98,7 @@ curl -k -XPOST -H "Content-Type: application/json" https://localhost:5000/api/re
101
98
],
102
99
"descriptions": [
103
100
{
104
- "description": "A story on how Julio Cesar relates to Gladiator .",
101
+ "description": "A story about how permissions work .",
105
102
"type": "Abstract",
106
103
"lang": "eng"
107
104
}
@@ -130,7 +127,31 @@ As you can see, the server could not know if we are authenticated/superuser and
130
127
}
131
128
```
132
129
133
- !!!todo
134
- Document how to generate an API token when permissions via token work .
130
+ Let's create a user with the right permission, generate her token and use the API
131
+ with it .
135
132
136
- Revert the changes in ` invenio.cfg ` and restart the server to get back to where we were.
133
+ ``` bash
134
+ pipenv run invenio users create
[email protected] --password=123456 --active
135
+ ```
136
+
137
+ ``` bash
138
+ pipenv run invenio roles add
[email protected] admin
139
+ ```
140
+
141
+ Login through the browser as
` [email protected] ` with password
` 123456 ` . Then
142
+ in the dropdown menu of the username (top-right), select ` Applications ` . Then
143
+ click on ` New token ` , name your token and click ` Create ` . Copy this token (we
144
+ will refer to it as ` <your token> ` ) and put it in the API call as such:
145
+
146
+ ``` bash
147
+ curl -k -XPOST -H " Authorization:Bearer <your token>" -H " Content-Type: application/json" https://localhost:5000/api/records/ -d ' {
148
+ ...<fill with the above>...
149
+ }'
150
+ ```
151
+
152
+ And it works! That's because InvenioRDM creates an ` admin ` role with super user
153
+ access permissions when initially setting up the database. Above, we set
154
+ ` [email protected] ` to be an admin, so that user can create records.
155
+
156
+ Revert the changes in ` invenio.cfg ` and restart the server to get back to where
157
+ we were.
0 commit comments