mirror of
https://github.com/nextcloud/passman.git
synced 2025-02-27 00:43:02 +08:00
Merge branch 'sharing_no_groups' of github.com:nextcloud/passman into sharing_no_groups
This commit is contained in:
commit
ef9b4b1b1b
3 changed files with 24 additions and 0 deletions
|
@ -58,6 +58,7 @@ return [
|
|||
['name' => 'share#getVaultItems', 'url' => '/api/v2/sharing/vault/{vault_guid}/get', 'verb' => 'GET'],
|
||||
['name' => 'share#getRevisions', 'url' => '/api/v2/sharing/revisions/{item_guid}', 'verb' => 'GET'],
|
||||
['name' => 'share#getCredentialData', 'url' => '/api/v2/sharing/credential/{credential_guid}', 'verb' => 'GET'],
|
||||
['name' => 'share#createPublicShare', 'url' => '/api/v2/sharing/sharing/public', 'verb' => 'POST'],
|
||||
|
||||
//Internal API
|
||||
['name' => 'internal#remind', 'url' => '/api/internal/notifications/remind/{credential_id}', 'verb' => 'POST'],
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
namespace OCA\Passman\Controller;
|
||||
|
||||
use OCA\Passman\Db\ShareRequest;
|
||||
use OCA\Passman\Db\SharingACL;
|
||||
use OCA\Passman\Db\Vault;
|
||||
use OCA\Passman\Service\CredentialService;
|
||||
use OCA\Passman\Service\NotificationService;
|
||||
|
@ -68,6 +69,23 @@ class ShareController extends ApiController {
|
|||
$this->notificationService = $notificationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $item_id
|
||||
* @param $item_guid
|
||||
* @param $permissions
|
||||
* @param $expire_timestamp
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function createPublicShare($item_id, $item_guid, $permissions, $expire_timestamp) {
|
||||
$acl = new SharingACL();
|
||||
|
||||
$acl->setItemId($item_id);
|
||||
$acl->setVaultGuid($item_guid);
|
||||
$acl->setPermissions($permissions);
|
||||
$acl->setExpire($expire_timestamp);
|
||||
|
||||
$this->shareService($acl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
|
|
|
@ -67,6 +67,11 @@ class ShareService {
|
|||
return $requests;
|
||||
}
|
||||
|
||||
public function createACLEntry(SharingACL $acl){
|
||||
if ($acl->getCreated() == null) $acl->setCreated((new \DateTime())->getTimestamp());
|
||||
return $this->sharingACL->createACLEntry($acl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the given share, defaults to no expire
|
||||
* @param $item_guid
|
||||
|
|
Loading…
Reference in a new issue