Add example for activity shared item

This commit is contained in:
brantje 2016-09-23 17:03:36 +02:00
parent 22f519e641
commit 0fd24a5002
2 changed files with 15 additions and 6 deletions

View file

@ -27,9 +27,7 @@ use OCA\Passman\Service\UserService;
class ShareController extends ApiController { class ShareController extends ApiController {
private $userId; private $userId;
private $vaultService; private $activityService;
private $credentialService;
private $userService;
private $groupManager; private $groupManager;
private $userManager; private $userManager;
@ -42,13 +40,14 @@ class ShareController extends ApiController {
IRequest $request, IRequest $request,
IUser $UserId, IUser $UserId,
IGroupManager $groupManager, IGroupManager $groupManager,
IUserManager $userManager IUserManager $userManager,
ActivityService $activityService
) { ) {
parent::__construct($AppName, $request); parent::__construct($AppName, $request);
$this->userId = $UserId; $this->userId = $UserId;
$this->userManager = $userManager; $this->userManager = $userManager;
$this->groupManager = $groupManager; $this->groupManager = $groupManager;
$this->activityService = $activityService;
} }
@ -95,4 +94,13 @@ class ShareController extends ApiController {
} }
public function share($credential){
$link = '';
$this->activityService->add(
'item_shared', array($credential->label, $this->userId),
'', array(),
$link, $this->userId, Activity::TYPE_ITEM_ACTION);
}
} }

View file

@ -52,7 +52,8 @@ class Application extends App {
$server->getUserManager(), $server->getUserManager(),
$server->getShareManager(), $server->getShareManager(),
$server->getURLGenerator(), $server->getURLGenerator(),
$server->getL10N($c->query('AppName')) $server->getL10N($c->query('AppName')),
$c->query('ActivityService')
); );
}); });