1 | <?php |
||
21 | class InternalController extends ApiController { |
||
22 | private $userId; |
||
23 | private $credentialService; |
||
24 | private $config; |
||
25 | |||
26 | public function __construct($AppName, |
||
27 | IRequest $request, |
||
28 | $UserId, |
||
29 | CredentialService $credentialService, |
||
30 | IConfig $config |
||
31 | ) { |
||
32 | parent::__construct($AppName, $request); |
||
33 | $this->userId = $UserId; |
||
34 | $this->credentialService = $credentialService; |
||
35 | $this->config = $config; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @NoAdminRequired |
||
40 | */ |
||
41 | public function remind($credential_id) { |
||
42 | $credential = $this->credentialService->getCredentialById($credential_id, $this->userId); |
||
43 | $credential->setExpireTime(time() + (24 * 60 * 60)); |
||
44 | $this->credentialService->upd($credential); |
||
45 | |||
46 | $manager = \OC::$server->getNotificationManager(); |
||
47 | $notification = $manager->createNotification(); |
||
48 | $notification->setApp('passman') |
||
49 | ->setObject('credential', $credential_id) |
||
50 | ->setUser($this->userId); |
||
51 | $manager->markProcessed($notification); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @NoAdminRequired |
||
56 | */ |
||
57 | public function read($credential_id) { |
||
58 | |||
59 | $credential = $this->credentialService->getCredentialById($credential_id, $this->userId); |
||
60 | $credential->setExpireTime(0); |
||
61 | $this->credentialService->upd($credential); |
||
62 | |||
63 | $manager = \OC::$server->getNotificationManager(); |
||
64 | $notification = $manager->createNotification(); |
||
65 | $notification->setApp('passman') |
||
66 | ->setObject('credential', $credential_id) |
||
67 | ->setUser($this->userId); |
||
68 | $manager->markProcessed($notification); |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @NoAdminRequired |
||
73 | * @NoCSRFRequired |
||
74 | */ |
||
75 | public function getAppVersion() { |
||
76 | $AppInstance = new App(); |
||
77 | return new JSONResponse(array('version' => $AppInstance->getAppInfo("passman")["version"])); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @NoAdminRequired |
||
82 | */ |
||
83 | 1 | public function generatePerson() { |
|
87 | |||
88 | /** |
||
89 | * @NoAdminRequired |
||
90 | * @NoCSRFRequired |
||
91 | */ |
||
92 | public function getSettings() { |
||
103 | |||
104 | /** |
||
105 | * @NoCSRFRequired |
||
106 | */ |
||
107 | public function saveSettings($key, $value) { |
||
113 | |||
114 | } |