-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contexts API #861
Contexts API #861
Conversation
I see some Controller names are prefixed with |
d3f5598
to
ac34b9d
Compare
<referencedClass name="Doctrine\DBAL\Types\Types" /> | ||
<referencedClass name="OC\Core\Command\Base" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
activity is doing the same 😇
ac34b9d
to
e9a4741
Compare
Added also a GET to fetch the information for a context. While in the overview there are only basic information from the context DB, the endpoint for a specific context is more detailed. It fetches data for sharing, the nodes, and the pages as well. Unfold Get full context information for a context receiver (by share) to get a response preview (ignore the permission value of 660, that's a placeholder for now). The table/view data has to be fetched separately. @enjeck What do you think? Did i oversee something, or do you have ideas for improvements? The second commit is not super clean yet (therefore the temporary commit message), but generally should do what it does. I wonder whether i misuse the Mapper and Entity though, going across the tables. I could split of all the fetching of the sharing, node, and page data, but it would result in more DB queries. And in the end I'd have to compose them altogether in some type as well. Insofar I guess it is ok (unless some future need suggests otherwise - the modification parts are still ahead). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@enjeck What do you think? Did i oversee something, or do you have ideas for improvements?
I don't understand enough of the code to say much. But if there's a GET request for fetching contexts, I guess we'll have more for creating, editing and deleting?
Yes, unfold the examples in the PR description ^ There is a usage example with curl as well as result output. Creating, Editing, Deleting will follow. So far i filled tables with dummy data for my testing. |
6c4259d
to
0b3bc71
Compare
Just pushed a quick implementation of creating contexts (no occ yet, curl example added to description). |
9567cb2
to
43208a1
Compare
4c7f6c2
to
063457f
Compare
bdc9e09
to
f8a1591
Compare
Added more endpoints and two examples ^ |
f8a1591
to
54b7c70
Compare
Almost complete, not very polished, but the endpoints should be there (just transfer upcoming) – I rushed it a bit now.. Needs better descriptions and I have to make it nice for openapi, but the examples in the description ^ should give a good idea already. Happy about feedback and of course open for improvements. |
3140478
to
618fa9a
Compare
Updated Controller information for OpenAPI, but did not regenerated openapi.json, because it needs #919 |
|
||
$context = $this->contextMapper->update($context); | ||
|
||
$auditEvent = new CriticalActionPerformedEvent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I wasn't aware we have this event
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
- also emits an Event for admin_audit Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
- includes a fix to also show pages that have no content Signed-off-by: Arthur Schiwon <[email protected]>
a600647
to
5f3813d
Compare
(rebased) |
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
5f3813d
to
76d64d3
Compare
Signed-off-by: Arthur Schiwon <[email protected]>
76d64d3
to
dd896ac
Compare
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
contributes to #311
Implementation state
Examples
Index
Get an overview of available contexts for the current user
Request
Result
The context with ID 0 stems for a share towards requesting user alice (either direct or group share), while the context with ID 3 is owned by them.
ownerType
is always 0 (= user) in the first Contexts iteration.Get full context information for a context receiver (by share)
Show Context
Request
Result
Create Context
Creating a context
The nodes are optional. The context is created empty without nodes, when those are not provided.
Request
Return
Update Context
Updating a context
This does not include transfering a context. The basic information name iconName and description can be changed. When their values are not provided, they are being left unchanged.
Request
Return
The full Context object is being returned.
Delete a specific node from a Context
Deleting a node from a context
The node is being automatically removed from any page content. The whole Context object is returned upon success.
Request
Return
Change order of contents in a page
Change the order of the page
In this example, the order of three content items is changed. One does not exists. Those are being ignored. However returned are only the content items that actually where updated.
Request
Return
Transfer ownership of a Context
Change the owner of the context
At the moment where we only support user owner contexts, the
newOwnerType
parameter is optional and defaults to0
(user), but might change in future.The user the context is transferred to must exist.
Request
Return
occ Commands
I also added them while doing it
occ tables:contexts:list [options] [--] [<user-id>]
occ tables:contexts:show [options] [--] <context-id> [<user-id>]