Conversation
c40f0c2 to
462afd8
Compare
|
All the endpoints are only intended to be used by admins? |
Apologies, didn't realize I did not link the issue ticket. I've updated the description. |
462afd8 to
3e2659b
Compare
| * | ||
| * 200: user/provider states | ||
| */ | ||
| #[ApiRoute(verb: 'POST', url: '/state', root: '/twofactor')] |
There was a problem hiding this comment.
Hey,
The reason this is a POST is because its pretty messy to send an array of user names in a GET url.
This command retrieves the states for specific users not just one user.
POST /twofactor/state
{
"users": ["admin", "user1", "user2"]
}
There was a problem hiding this comment.
It is possible using this syntax: ?user[]=a&user[]=b, but indeed very ugly. Not sure what is better here 😅
There was a problem hiding this comment.
GET is the right verb here. If the arguments make the URL ugly so be it.
As an alternative you could drop the bulk operation aspect. It's not a concept I've seen with any other Nextcloud APIs. If there is only one user, like with the occ command, the URL will become "pretty" again.
There was a problem hiding this comment.
Agreed, if there is no need to query multiple users at once then it is much better to only implement it for a single user.
There was a problem hiding this comment.
Well the idea behind the bulk operation was that an external system can check the state of 2fa on a 100+ accounts at the same time instead of doing 100 requests.
But if you insist on this being a GET then having this as an array makes it ugly. I'll change it.
| * | ||
| * 200: user/provider states | ||
| */ | ||
| #[ApiRoute(verb: 'POST', url: '/state', root: '/twofactor')] |
There was a problem hiding this comment.
POST is still used here.
There was a problem hiding this comment.
Yes, its because I didn't see you comments before asking for a review.
3e2659b to
900130c
Compare
Signed-off-by: SebastianKrupinski <[email protected]>
68f0716 to
332fa63
Compare
Ability to check/enable/disable configured 2FA with API endpoint
Request State
Request Disable
Request Enable