get circle details

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Maxence Lange 2021-05-03 15:40:16 -01:00
parent 23585cb999
commit 6eb10807c9
5 changed files with 29 additions and 64 deletions

View file

@ -1,20 +1,21 @@
# Nextcloud Circles # Nextcloud Circles
_**Important Notes**: ### Important Notes
- `master` contains a version of Circles for NC22 and is not compatible with older version of Nextcloud_ - `master` contains a version of Circles for NC22 and is not compatible with older version of Nextcloud_
- Because of the huge difference between the last version and version prior to 22.0.0, any bugfixes about Circles for NC21 and older version should be applied to stable21. - Because of the huge difference between the last version and version prior to 22.0.0, any bugfixes about Circles for NC21 and older version should be applied to stable21.
**Bring cloud-users closer together.** ### Bring cloud-users closer together
Circles allow your users to create their own groups of users/colleagues/friends. Circles allow your users to create their own groups of users/colleagues/friends.
Those groups of users (or circles) can then be used by any other app for sharing purpose Those groups of users (or circles) can then be used by any other app for sharing purpose
through the Circles API through the Circles API
*** ***
# API (PHP & Javascript) (Deprecated since NC22) # API (PHP & Javascript) (Deprecated since NC22)
[Please visit our wiki to read more about the API.](https://github.com/nextcloud/circles/wiki) [Please visit our wiki to read more about the API.](https://github.com/nextcloud/circles/wiki)

59
TODO.md
View file

@ -1,59 +0,0 @@
###
- Verify that a user can be added to this circle (based on the Config of the circle)
-
### Must be done when the project is more advanced:
Cannot be done until I get a better overview of the project
- [ ] #M004: confirm Member (hasMember() and member have an instance set) when managing RemoteEvent
- [ ] #E001: confirm and manage event when initiated from another instance.
- [ ] #C001: allow an 'All' request to the database only available to the backend to also includes some specific circles (single, fully hidden, ...)
### Lazy while coding:
I got lazy and afraid to get lost the first throw of code
- [ ] #M003: confirm other type of User when adding a new member to a circle.
- [ ] confirm MemberId and CircleId is really not known before creating entry in database.
- [x] Add better option to circles:manage:list
- [ ] when generating Single circle, update single_id with the generated id in the table circle_members
### Ideas
Some sparks that can happens anytime of the day or night.
### Questions
Should I do it ?
### renaming
Some Model/Method needs renaming for better readability
- [x] rename getViewer/setViewer to getInitiator/setInitiator
- [x] rename IMember to IFederatedUser
- [ ] rename Member to CircleMember
- [x] rename CurrentUser to FederatedUser
- [x] rename IRemoteEvent to IFederatedItem, IFederatedCommand, IFederatedAction, IFederatedObject
- [x] rename RemoteEvent to FederatedEvent
### Over the top
- [ ] #M002: When adding a member from a remote instance, request the remote instance to check user availability. Might be better to add an option to allow that check.
### Document
Because, you know...

View file

@ -35,6 +35,7 @@ return [
['name' => 'Local#create', 'url' => '/circles', 'verb' => 'POST'], ['name' => 'Local#create', 'url' => '/circles', 'verb' => 'POST'],
['name' => 'Local#destroy', 'url' => '/circles/{circleId}', 'verb' => 'DELETE'], ['name' => 'Local#destroy', 'url' => '/circles/{circleId}', 'verb' => 'DELETE'],
['name' => 'Local#search', 'url' => '/search', 'verb' => 'GET'], ['name' => 'Local#search', 'url' => '/search', 'verb' => 'GET'],
['name' => 'Local#circleDetails', 'url' => '/circles/{circleId}', 'verb' => 'GET'],
['name' => 'Local#members', 'url' => '/circles/{circleId}/members', 'verb' => 'GET'], ['name' => 'Local#members', 'url' => '/circles/{circleId}/members', 'verb' => 'GET'],
['name' => 'Local#memberAdd', 'url' => '/circles/{circleId}/members', 'verb' => 'POST'], ['name' => 'Local#memberAdd', 'url' => '/circles/{circleId}/members', 'verb' => 'POST'],
['name' => 'Local#membersAdd', 'url' => '/circles/{circleId}/members/multi', 'verb' => 'POST'], ['name' => 'Local#membersAdd', 'url' => '/circles/{circleId}/members/multi', 'verb' => 'POST'],

View file

@ -149,7 +149,6 @@ class CirclesDetails extends Base {
$data = ['initiator' => $initiator]; $data = ['initiator' => $initiator];
$circle = $this->remoteService->getCircleFromInstance($circleId, $instance, $data); $circle = $this->remoteService->getCircleFromInstance($circleId, $instance, $data);
} else { } else {
try { try {
$this->federatedUserService->commandLineInitiator($initiator, $circleId, true); $this->federatedUserService->commandLineInitiator($initiator, $circleId, true);
$circle = $this->circleService->getCircle($circleId, 0); $circle = $this->circleService->getCircle($circleId, 0);

View file

@ -173,6 +173,25 @@ class LocalController extends OcsController {
} }
/**
* @NoAdminRequired
*
* @param string $circleId
*
* @return DataResponse
* @throws OCSException
*/
public function circleDetails(string $circleId): DataResponse {
try {
$this->setCurrentFederatedUser();
return new DataResponse($this->circleService->getCircle($circleId));
} catch (Exception $e) {
throw new OcsException($e->getMessage(), $e->getCode());
}
}
/** /**
* @NoAdminRequired * @NoAdminRequired
* *
@ -379,6 +398,7 @@ class LocalController extends OcsController {
$this->setCurrentFederatedUser(); $this->setCurrentFederatedUser();
$this->circleService->updateDisplayName($circleId, $value); $this->circleService->updateDisplayName($circleId, $value);
return new DataResponse($this->circleService->getCircle($circleId)); return new DataResponse($this->circleService->getCircle($circleId));
} catch (Exception $e) { } catch (Exception $e) {
throw new OCSException($e->getMessage(), $e->getCode()); throw new OCSException($e->getMessage(), $e->getCode());
@ -398,6 +418,7 @@ class LocalController extends OcsController {
$this->setCurrentFederatedUser(); $this->setCurrentFederatedUser();
$this->circleService->updateDescription($circleId, $value); $this->circleService->updateDescription($circleId, $value);
return new DataResponse($this->circleService->getCircle($circleId)); return new DataResponse($this->circleService->getCircle($circleId));
} catch (Exception $e) { } catch (Exception $e) {
throw new OCSException($e->getMessage(), $e->getCode()); throw new OCSException($e->getMessage(), $e->getCode());
@ -417,6 +438,7 @@ class LocalController extends OcsController {
$this->setCurrentFederatedUser(); $this->setCurrentFederatedUser();
$this->circleService->updateSettings($circleId, $value); $this->circleService->updateSettings($circleId, $value);
return new DataResponse($this->circleService->getCircle($circleId)); return new DataResponse($this->circleService->getCircle($circleId));
} catch (Exception $e) { } catch (Exception $e) {
throw new OCSException($e->getMessage(), $e->getCode()); throw new OCSException($e->getMessage(), $e->getCode());
@ -436,6 +458,7 @@ class LocalController extends OcsController {
$this->setCurrentFederatedUser(); $this->setCurrentFederatedUser();
$this->circleService->updateConfig($circleId, $value); $this->circleService->updateConfig($circleId, $value);
return new DataResponse($this->circleService->getCircle($circleId)); return new DataResponse($this->circleService->getCircle($circleId));
} catch (Exception $e) { } catch (Exception $e) {
throw new OCSException($e->getMessage(), $e->getCode()); throw new OCSException($e->getMessage(), $e->getCode());