Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
STALE BRANCH, PR KEPT OPEN FOR REFERENCE
Purpose
Currently, the API has no restriction to the data / endpoints available. All authenticated users have unlimited read and write access, through all endpoints. The purpose, of this PR, (initiated by #288) is to add security mechanism including scopes and permissions. The xAPI specification suggests these scopes.
NB: The term "scope" is used losely, as the authentification mode (for now) is Basic Auth ("scope" is usually used in the context of OAuth). We use the term in a similar sense but applied to a user. (eg. "a user has the right to access scope
/statements/read/mine
").Proposal
Adding scopes is relatively straightforward except for the scope
/statements/read/mine
, which requires to add a notion of belonging to the statements being stored. This notion is covered by the xAPI specification under the name "Authority", which is a field that SHOULD be created by the LRS upon receiving statements and populated with the requesting user account information. Thisauthority
field may then be used to filter incoming queries and/or results.The proposed solution (a first pass) includes pre-processing the data to add "Authority", implementing scopes, and adding a permissions mechanism which forces user to query using an
authority
field, when the broadest scope available is/statements/read/mine
.The proposed pre-processing also handles annex LRS conformity issues, by adding to the statements the fields
timestamp
,stored
andid
(when not present).Description...
POST
andPUT
fortimestamp
,stored
,id
timestamp
,stored
,id
forPUT
timestamp
,stored
,id
forPOST
GET
,POST
,PUT
)POST
andPUT
forauthority
(separate as it is a more complex issue)authority
forPOST
authority
forPUT