Skip to content

Commit

Permalink
Merge pull request #102 from 5pm-HDH/permission-request
Browse files Browse the repository at this point in the history
Permission request
  • Loading branch information
DumbergerL authored Sep 2, 2022
2 parents 9b5452e + b16e900 commit d198b80
Show file tree
Hide file tree
Showing 28 changed files with 2,862 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [Added modifiable-attributes to person-api docs](https://github.com/5pm-HDH/churchtools-api/pull/88)
- [Added method to delete person records](https://github.com/5pm-HDH/churchtools-api/pull/91)
- [Added Calendar-Request](https://github.com/5pm-HDH/churchtools-api/pull/92)
- [Added Permission-Request](https://github.com/5pm-HDH/churchtools-api/pull/102)

### Changed
- [Refactor CTClient:](https://github.com/5pm-HDH/churchtools-api/pull/83) transform inheritance from GuzzleClient to composition-relation
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ All APIs with examples:
* [Song-API](/docs/out/SongAPI.md)
* [Service-API](/docs/out/ServiceAPI.md)
* [Wiki-API](/docs/out/WikiAPI.md)

* [Permission-API](/docs/out/PermissionAPI.md)

The following short examples show the power of this ChurchTools-api client and gives a rough overview over the possibilities:

Expand Down
12 changes: 6 additions & 6 deletions docs/out/EventAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@
$eventSongsList = "";
$agendaItems = ($agenda?->getItems() ?? []);
foreach ($agendaItems as $item) {
$eventItemsList .= $item->getTitle() . " (" . $item->getType() . "), ";
$eventItemsList .= $item->getTitle() . " (" . $item->getType() . "); ";
$song = $item->getSong();
if (!is_null($song)) {
$eventSongsList .= $song->getName() . ", ";
$eventSongsList .= $song->getName() . "; ";
}
}

var_dump( First Worship Song (Song), Sermon (Default), ", $eventItemsList);
// Output: "Opening Song (Song)
var_dump( $eventItemsList);
// Output: "Opening Song (Song); First Worship Song (Song); Sermon (Default); "

var_dump( ", $eventSongsList);
// Output: "We welcome you
var_dump( $eventSongsList);
// Output: "We welcome you; "


$songs = $agenda?->requestSongs();
Expand Down
80 changes: 80 additions & 0 deletions docs/out/PermissionAPI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Permission API

## Internal Group Permission

```php
use CTApi\CTConfig;
use CTApi\Requests\PermissionRequest;

$internalGroupPermission = PermissionRequest::forGroup(21)->get();

var_dump( $internalGroupPermission->getSeeGroupTags());
// Output: true

var_dump( $internalGroupPermission->getAddPerson());
// Output: true

var_dump( $internalGroupPermission->getMailGroupMembers());
// Output: true

// ... see InternalGroupPermission-Model

```

## Internal Person Permission

```php
use CTApi\CTConfig;
use CTApi\Requests\PermissionRequest;

$internalPersonPermission = PermissionRequest::forPerson(23)->get();

var_dump( $internalPersonPermission->getSeePersons());
// Output: 2

var_dump( $internalPersonPermission->getInvitePerson());
// Output: true

var_dump( $internalPersonPermission->getSeeTags());
// Output: true

var_dump( $internalPersonPermission->getEditPersons());
// Output: true

var_dump( $internalPersonPermission->getDoFollowup());
// Output: true


```

## Global Permission (for logged in user)

```php
use CTApi\CTConfig;
use CTApi\Requests\PermissionRequest;

$globalPermission = PermissionRequest::myPermissions()->get();

var_dump( $globalPermission->getChurchcore()?->getAdministerSettings());
// Output: true

var_dump( $globalPermission->getChurchdb()?->getViewBirthdaylist());
// Output: false

var_dump( $globalPermission->getChurchcal()?->getView());
// Output: true

var_dump( $globalPermission->getChurchresource()?->getCreateVirtualBookings());
// Output: false

var_dump( $globalPermission->getChurchservice()?->getEditTemplate());
// Output: true

var_dump( $globalPermission->getChurchwiki()->getEditMasterdata());
// Output: true

var_dump( $globalPermission->getChurchcheckin()?->getEditMasterdata());
// Output: false


```
13 changes: 13 additions & 0 deletions docs/src/ressources/PermissionAPI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Permission API

## Internal Group Permission

{{ \Tests\Unit\Docs\PermissionRequestTest.testGroupPermission }}

## Internal Person Permission

{{ \Tests\Unit\Docs\PermissionRequestTest.testPersonPermission }}

## Global Permission (for logged in user)

{{ \Tests\Unit\Docs\PermissionRequestTest.testGlobalPermission }}
Loading

0 comments on commit d198b80

Please sign in to comment.