@@ -31,30 +31,30 @@ |
||
31 | 31 | use OCP\Command\ICommand; |
32 | 32 | |
33 | 33 | class Expire implements ICommand { |
34 | - use FileAccess; |
|
34 | + use FileAccess; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - private $user; |
|
36 | + /** |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + private $user; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param string $user |
|
43 | - */ |
|
44 | - function __construct($user) { |
|
45 | - $this->user = $user; |
|
46 | - } |
|
41 | + /** |
|
42 | + * @param string $user |
|
43 | + */ |
|
44 | + function __construct($user) { |
|
45 | + $this->user = $user; |
|
46 | + } |
|
47 | 47 | |
48 | - public function handle() { |
|
49 | - $userManager = \OC::$server->getUserManager(); |
|
50 | - if (!$userManager->userExists($this->user)) { |
|
51 | - // User has been deleted already |
|
52 | - return; |
|
53 | - } |
|
48 | + public function handle() { |
|
49 | + $userManager = \OC::$server->getUserManager(); |
|
50 | + if (!$userManager->userExists($this->user)) { |
|
51 | + // User has been deleted already |
|
52 | + return; |
|
53 | + } |
|
54 | 54 | |
55 | - \OC_Util::tearDownFS(); |
|
56 | - \OC_Util::setupFS($this->user); |
|
57 | - Trashbin::expire($this->user); |
|
58 | - \OC_Util::tearDownFS(); |
|
59 | - } |
|
55 | + \OC_Util::tearDownFS(); |
|
56 | + \OC_Util::setupFS($this->user); |
|
57 | + Trashbin::expire($this->user); |
|
58 | + \OC_Util::tearDownFS(); |
|
59 | + } |
|
60 | 60 | } |
@@ -34,94 +34,94 @@ |
||
34 | 34 | |
35 | 35 | class ExpireTrash extends Command { |
36 | 36 | |
37 | - /** |
|
38 | - * @var Expiration |
|
39 | - */ |
|
40 | - private $expiration; |
|
37 | + /** |
|
38 | + * @var Expiration |
|
39 | + */ |
|
40 | + private $expiration; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @var IUserManager |
|
44 | - */ |
|
45 | - private $userManager; |
|
42 | + /** |
|
43 | + * @var IUserManager |
|
44 | + */ |
|
45 | + private $userManager; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param IUserManager|null $userManager |
|
49 | - * @param Expiration|null $expiration |
|
50 | - */ |
|
51 | - public function __construct(IUserManager $userManager = null, |
|
52 | - Expiration $expiration = null) { |
|
53 | - parent::__construct(); |
|
47 | + /** |
|
48 | + * @param IUserManager|null $userManager |
|
49 | + * @param Expiration|null $expiration |
|
50 | + */ |
|
51 | + public function __construct(IUserManager $userManager = null, |
|
52 | + Expiration $expiration = null) { |
|
53 | + parent::__construct(); |
|
54 | 54 | |
55 | - $this->userManager = $userManager; |
|
56 | - $this->expiration = $expiration; |
|
57 | - } |
|
55 | + $this->userManager = $userManager; |
|
56 | + $this->expiration = $expiration; |
|
57 | + } |
|
58 | 58 | |
59 | - protected function configure() { |
|
60 | - $this |
|
61 | - ->setName('trashbin:expire') |
|
62 | - ->setDescription('Expires the users trashbin') |
|
63 | - ->addArgument( |
|
64 | - 'user_id', |
|
65 | - InputArgument::OPTIONAL | InputArgument::IS_ARRAY, |
|
66 | - 'expires the trashbin of the given user(s), if no user is given the trash for all users will be expired' |
|
67 | - ); |
|
68 | - } |
|
59 | + protected function configure() { |
|
60 | + $this |
|
61 | + ->setName('trashbin:expire') |
|
62 | + ->setDescription('Expires the users trashbin') |
|
63 | + ->addArgument( |
|
64 | + 'user_id', |
|
65 | + InputArgument::OPTIONAL | InputArgument::IS_ARRAY, |
|
66 | + 'expires the trashbin of the given user(s), if no user is given the trash for all users will be expired' |
|
67 | + ); |
|
68 | + } |
|
69 | 69 | |
70 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
70 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
71 | 71 | |
72 | - $maxAge = $this->expiration->getMaxAgeAsTimestamp(); |
|
73 | - if (!$maxAge) { |
|
74 | - $output->writeln("No expiry configured."); |
|
75 | - return; |
|
76 | - } |
|
72 | + $maxAge = $this->expiration->getMaxAgeAsTimestamp(); |
|
73 | + if (!$maxAge) { |
|
74 | + $output->writeln("No expiry configured."); |
|
75 | + return; |
|
76 | + } |
|
77 | 77 | |
78 | - $users = $input->getArgument('user_id'); |
|
79 | - if (!empty($users)) { |
|
80 | - foreach ($users as $user) { |
|
81 | - if ($this->userManager->userExists($user)) { |
|
82 | - $output->writeln("Remove deleted files of <info>$user</info>"); |
|
83 | - $userObject = $this->userManager->get($user); |
|
84 | - $this->expireTrashForUser($userObject); |
|
85 | - } else { |
|
86 | - $output->writeln("<error>Unknown user $user</error>"); |
|
87 | - } |
|
88 | - } |
|
89 | - } else { |
|
90 | - $p = new ProgressBar($output); |
|
91 | - $p->start(); |
|
92 | - $this->userManager->callForSeenUsers(function(IUser $user) use ($p) { |
|
93 | - $p->advance(); |
|
94 | - $this->expireTrashForUser($user); |
|
95 | - }); |
|
96 | - $p->finish(); |
|
97 | - $output->writeln(''); |
|
98 | - } |
|
99 | - } |
|
78 | + $users = $input->getArgument('user_id'); |
|
79 | + if (!empty($users)) { |
|
80 | + foreach ($users as $user) { |
|
81 | + if ($this->userManager->userExists($user)) { |
|
82 | + $output->writeln("Remove deleted files of <info>$user</info>"); |
|
83 | + $userObject = $this->userManager->get($user); |
|
84 | + $this->expireTrashForUser($userObject); |
|
85 | + } else { |
|
86 | + $output->writeln("<error>Unknown user $user</error>"); |
|
87 | + } |
|
88 | + } |
|
89 | + } else { |
|
90 | + $p = new ProgressBar($output); |
|
91 | + $p->start(); |
|
92 | + $this->userManager->callForSeenUsers(function(IUser $user) use ($p) { |
|
93 | + $p->advance(); |
|
94 | + $this->expireTrashForUser($user); |
|
95 | + }); |
|
96 | + $p->finish(); |
|
97 | + $output->writeln(''); |
|
98 | + } |
|
99 | + } |
|
100 | 100 | |
101 | - function expireTrashForUser(IUser $user) { |
|
102 | - $uid = $user->getUID(); |
|
103 | - if (!$this->setupFS($uid)) { |
|
104 | - return; |
|
105 | - } |
|
106 | - $dirContent = Helper::getTrashFiles('/', $uid, 'mtime'); |
|
107 | - Trashbin::deleteExpiredFiles($dirContent, $uid); |
|
108 | - } |
|
101 | + function expireTrashForUser(IUser $user) { |
|
102 | + $uid = $user->getUID(); |
|
103 | + if (!$this->setupFS($uid)) { |
|
104 | + return; |
|
105 | + } |
|
106 | + $dirContent = Helper::getTrashFiles('/', $uid, 'mtime'); |
|
107 | + Trashbin::deleteExpiredFiles($dirContent, $uid); |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * Act on behalf on trash item owner |
|
112 | - * @param string $user |
|
113 | - * @return boolean |
|
114 | - */ |
|
115 | - protected function setupFS($user) { |
|
116 | - \OC_Util::tearDownFS(); |
|
117 | - \OC_Util::setupFS($user); |
|
110 | + /** |
|
111 | + * Act on behalf on trash item owner |
|
112 | + * @param string $user |
|
113 | + * @return boolean |
|
114 | + */ |
|
115 | + protected function setupFS($user) { |
|
116 | + \OC_Util::tearDownFS(); |
|
117 | + \OC_Util::setupFS($user); |
|
118 | 118 | |
119 | - // Check if this user has a trashbin directory |
|
120 | - $view = new \OC\Files\View('/' . $user); |
|
121 | - if (!$view->is_dir('/files_trashbin/files')) { |
|
122 | - return false; |
|
123 | - } |
|
119 | + // Check if this user has a trashbin directory |
|
120 | + $view = new \OC\Files\View('/' . $user); |
|
121 | + if (!$view->is_dir('/files_trashbin/files')) { |
|
122 | + return false; |
|
123 | + } |
|
124 | 124 | |
125 | - return true; |
|
126 | - } |
|
125 | + return true; |
|
126 | + } |
|
127 | 127 | } |
@@ -33,17 +33,17 @@ |
||
33 | 33 | */ |
34 | 34 | class Capabilities implements ICapability { |
35 | 35 | |
36 | - /** |
|
37 | - * Return this classes capabilities |
|
38 | - * |
|
39 | - * @return array |
|
40 | - */ |
|
41 | - public function getCapabilities() { |
|
42 | - return [ |
|
43 | - 'files' => [ |
|
44 | - 'undelete' => true |
|
45 | - ] |
|
46 | - ]; |
|
47 | - } |
|
36 | + /** |
|
37 | + * Return this classes capabilities |
|
38 | + * |
|
39 | + * @return array |
|
40 | + */ |
|
41 | + public function getCapabilities() { |
|
42 | + return [ |
|
43 | + 'files' => [ |
|
44 | + 'undelete' => true |
|
45 | + ] |
|
46 | + ]; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | } |
@@ -34,76 +34,76 @@ |
||
34 | 34 | |
35 | 35 | class ExpireTrash extends \OC\BackgroundJob\TimedJob { |
36 | 36 | |
37 | - /** |
|
38 | - * @var Expiration |
|
39 | - */ |
|
40 | - private $expiration; |
|
37 | + /** |
|
38 | + * @var Expiration |
|
39 | + */ |
|
40 | + private $expiration; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @var IUserManager |
|
44 | - */ |
|
45 | - private $userManager; |
|
42 | + /** |
|
43 | + * @var IUserManager |
|
44 | + */ |
|
45 | + private $userManager; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param IUserManager|null $userManager |
|
49 | - * @param Expiration|null $expiration |
|
50 | - */ |
|
51 | - public function __construct(IUserManager $userManager = null, |
|
52 | - Expiration $expiration = null) { |
|
53 | - // Run once per 30 minutes |
|
54 | - $this->setInterval(60 * 30); |
|
47 | + /** |
|
48 | + * @param IUserManager|null $userManager |
|
49 | + * @param Expiration|null $expiration |
|
50 | + */ |
|
51 | + public function __construct(IUserManager $userManager = null, |
|
52 | + Expiration $expiration = null) { |
|
53 | + // Run once per 30 minutes |
|
54 | + $this->setInterval(60 * 30); |
|
55 | 55 | |
56 | - if (is_null($expiration) || is_null($userManager)) { |
|
57 | - $this->fixDIForJobs(); |
|
58 | - } else { |
|
59 | - $this->userManager = $userManager; |
|
60 | - $this->expiration = $expiration; |
|
61 | - } |
|
62 | - } |
|
56 | + if (is_null($expiration) || is_null($userManager)) { |
|
57 | + $this->fixDIForJobs(); |
|
58 | + } else { |
|
59 | + $this->userManager = $userManager; |
|
60 | + $this->expiration = $expiration; |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - protected function fixDIForJobs() { |
|
65 | - $application = new Application(); |
|
66 | - $this->userManager = \OC::$server->getUserManager(); |
|
67 | - $this->expiration = $application->getContainer()->query('Expiration'); |
|
68 | - } |
|
64 | + protected function fixDIForJobs() { |
|
65 | + $application = new Application(); |
|
66 | + $this->userManager = \OC::$server->getUserManager(); |
|
67 | + $this->expiration = $application->getContainer()->query('Expiration'); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @param $argument |
|
72 | - * @throws \Exception |
|
73 | - */ |
|
74 | - protected function run($argument) { |
|
75 | - $maxAge = $this->expiration->getMaxAgeAsTimestamp(); |
|
76 | - if (!$maxAge) { |
|
77 | - return; |
|
78 | - } |
|
70 | + /** |
|
71 | + * @param $argument |
|
72 | + * @throws \Exception |
|
73 | + */ |
|
74 | + protected function run($argument) { |
|
75 | + $maxAge = $this->expiration->getMaxAgeAsTimestamp(); |
|
76 | + if (!$maxAge) { |
|
77 | + return; |
|
78 | + } |
|
79 | 79 | |
80 | - $this->userManager->callForSeenUsers(function(IUser $user) { |
|
81 | - $uid = $user->getUID(); |
|
82 | - if (!$this->setupFS($uid)) { |
|
83 | - return; |
|
84 | - } |
|
85 | - $dirContent = Helper::getTrashFiles('/', $uid, 'mtime'); |
|
86 | - Trashbin::deleteExpiredFiles($dirContent, $uid); |
|
87 | - }); |
|
80 | + $this->userManager->callForSeenUsers(function(IUser $user) { |
|
81 | + $uid = $user->getUID(); |
|
82 | + if (!$this->setupFS($uid)) { |
|
83 | + return; |
|
84 | + } |
|
85 | + $dirContent = Helper::getTrashFiles('/', $uid, 'mtime'); |
|
86 | + Trashbin::deleteExpiredFiles($dirContent, $uid); |
|
87 | + }); |
|
88 | 88 | |
89 | - \OC_Util::tearDownFS(); |
|
90 | - } |
|
89 | + \OC_Util::tearDownFS(); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Act on behalf on trash item owner |
|
94 | - * @param string $user |
|
95 | - * @return boolean |
|
96 | - */ |
|
97 | - protected function setupFS($user) { |
|
98 | - \OC_Util::tearDownFS(); |
|
99 | - \OC_Util::setupFS($user); |
|
92 | + /** |
|
93 | + * Act on behalf on trash item owner |
|
94 | + * @param string $user |
|
95 | + * @return boolean |
|
96 | + */ |
|
97 | + protected function setupFS($user) { |
|
98 | + \OC_Util::tearDownFS(); |
|
99 | + \OC_Util::setupFS($user); |
|
100 | 100 | |
101 | - // Check if this user has a trashbin directory |
|
102 | - $view = new \OC\Files\View('/' . $user); |
|
103 | - if (!$view->is_dir('/files_trashbin/files')) { |
|
104 | - return false; |
|
105 | - } |
|
101 | + // Check if this user has a trashbin directory |
|
102 | + $view = new \OC\Files\View('/' . $user); |
|
103 | + if (!$view->is_dir('/files_trashbin/files')) { |
|
104 | + return false; |
|
105 | + } |
|
106 | 106 | |
107 | - return true; |
|
108 | - } |
|
107 | + return true; |
|
108 | + } |
|
109 | 109 | } |
@@ -27,66 +27,66 @@ |
||
27 | 27 | |
28 | 28 | class RequestURL extends AbstractStringCheck { |
29 | 29 | |
30 | - /** @var string */ |
|
31 | - protected $url; |
|
30 | + /** @var string */ |
|
31 | + protected $url; |
|
32 | 32 | |
33 | - /** @var IRequest */ |
|
34 | - protected $request; |
|
33 | + /** @var IRequest */ |
|
34 | + protected $request; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param IL10N $l |
|
38 | - * @param IRequest $request |
|
39 | - */ |
|
40 | - public function __construct(IL10N $l, IRequest $request) { |
|
41 | - parent::__construct($l); |
|
42 | - $this->request = $request; |
|
43 | - } |
|
36 | + /** |
|
37 | + * @param IL10N $l |
|
38 | + * @param IRequest $request |
|
39 | + */ |
|
40 | + public function __construct(IL10N $l, IRequest $request) { |
|
41 | + parent::__construct($l); |
|
42 | + $this->request = $request; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param string $operator |
|
47 | - * @param string $value |
|
48 | - * @return bool |
|
49 | - */ |
|
50 | - public function executeCheck($operator, $value) { |
|
51 | - $actualValue = $this->getActualValue(); |
|
52 | - if (in_array($operator, ['is', '!is'])) { |
|
53 | - switch ($value) { |
|
54 | - case 'webdav': |
|
55 | - if ($operator === 'is') { |
|
56 | - return $this->isWebDAVRequest(); |
|
57 | - } else { |
|
58 | - return !$this->isWebDAVRequest(); |
|
59 | - } |
|
60 | - } |
|
61 | - } |
|
62 | - return $this->executeStringCheck($operator, $value, $actualValue); |
|
63 | - } |
|
45 | + /** |
|
46 | + * @param string $operator |
|
47 | + * @param string $value |
|
48 | + * @return bool |
|
49 | + */ |
|
50 | + public function executeCheck($operator, $value) { |
|
51 | + $actualValue = $this->getActualValue(); |
|
52 | + if (in_array($operator, ['is', '!is'])) { |
|
53 | + switch ($value) { |
|
54 | + case 'webdav': |
|
55 | + if ($operator === 'is') { |
|
56 | + return $this->isWebDAVRequest(); |
|
57 | + } else { |
|
58 | + return !$this->isWebDAVRequest(); |
|
59 | + } |
|
60 | + } |
|
61 | + } |
|
62 | + return $this->executeStringCheck($operator, $value, $actualValue); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - protected function getActualValue() { |
|
69 | - if ($this->url !== null) { |
|
70 | - return $this->url; |
|
71 | - } |
|
65 | + /** |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + protected function getActualValue() { |
|
69 | + if ($this->url !== null) { |
|
70 | + return $this->url; |
|
71 | + } |
|
72 | 72 | |
73 | - $this->url = $this->request->getServerProtocol() . '://';// E.g. http(s) + :// |
|
74 | - $this->url .= $this->request->getServerHost();// E.g. localhost |
|
75 | - $this->url .= $this->request->getScriptName();// E.g. /nextcloud/index.php |
|
76 | - $this->url .= $this->request->getPathInfo();// E.g. /apps/files_texteditor/ajax/loadfile |
|
73 | + $this->url = $this->request->getServerProtocol() . '://';// E.g. http(s) + :// |
|
74 | + $this->url .= $this->request->getServerHost();// E.g. localhost |
|
75 | + $this->url .= $this->request->getScriptName();// E.g. /nextcloud/index.php |
|
76 | + $this->url .= $this->request->getPathInfo();// E.g. /apps/files_texteditor/ajax/loadfile |
|
77 | 77 | |
78 | - return $this->url; // E.g. https://localhost/nextcloud/index.php/apps/files_texteditor/ajax/loadfile |
|
79 | - } |
|
78 | + return $this->url; // E.g. https://localhost/nextcloud/index.php/apps/files_texteditor/ajax/loadfile |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * @return bool |
|
83 | - */ |
|
84 | - protected function isWebDAVRequest() { |
|
85 | - return substr($this->request->getScriptName(), 0 - strlen('/remote.php')) === '/remote.php' && ( |
|
86 | - $this->request->getPathInfo() === '/webdav' || |
|
87 | - strpos($this->request->getPathInfo(), '/webdav/') === 0 || |
|
88 | - $this->request->getPathInfo() === '/dav/files' || |
|
89 | - strpos($this->request->getPathInfo(), '/dav/files/') === 0 |
|
90 | - ); |
|
91 | - } |
|
81 | + /** |
|
82 | + * @return bool |
|
83 | + */ |
|
84 | + protected function isWebDAVRequest() { |
|
85 | + return substr($this->request->getScriptName(), 0 - strlen('/remote.php')) === '/remote.php' && ( |
|
86 | + $this->request->getPathInfo() === '/webdav' || |
|
87 | + strpos($this->request->getPathInfo(), '/webdav/') === 0 || |
|
88 | + $this->request->getPathInfo() === '/dav/files' || |
|
89 | + strpos($this->request->getPathInfo(), '/dav/files/') === 0 |
|
90 | + ); |
|
91 | + } |
|
92 | 92 | } |
@@ -34,23 +34,23 @@ |
||
34 | 34 | * ] |
35 | 35 | */ |
36 | 36 | class AlternativeHomeUserBackend extends \OC\User\Database { |
37 | - public function __construct() { |
|
38 | - parent::__construct(); |
|
39 | - } |
|
40 | - /** |
|
41 | - * get the user's home directory |
|
42 | - * @param string $uid the username |
|
43 | - * @return string|false |
|
44 | - */ |
|
45 | - public function getHome($uid) { |
|
46 | - if ($this->userExists($uid)) { |
|
47 | - // workaround to avoid killing the admin |
|
48 | - if ($uid !== 'admin') { |
|
49 | - $uid = md5($uid); |
|
50 | - } |
|
51 | - return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid; |
|
52 | - } |
|
37 | + public function __construct() { |
|
38 | + parent::__construct(); |
|
39 | + } |
|
40 | + /** |
|
41 | + * get the user's home directory |
|
42 | + * @param string $uid the username |
|
43 | + * @return string|false |
|
44 | + */ |
|
45 | + public function getHome($uid) { |
|
46 | + if ($this->userExists($uid)) { |
|
47 | + // workaround to avoid killing the admin |
|
48 | + if ($uid !== 'admin') { |
|
49 | + $uid = md5($uid); |
|
50 | + } |
|
51 | + return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid; |
|
52 | + } |
|
53 | 53 | |
54 | - return false; |
|
55 | - } |
|
54 | + return false; |
|
55 | + } |
|
56 | 56 | } |
@@ -33,30 +33,30 @@ |
||
33 | 33 | */ |
34 | 34 | class TokenHandler { |
35 | 35 | |
36 | - const TOKEN_LENGTH = 15; |
|
37 | - |
|
38 | - /** @var ISecureRandom */ |
|
39 | - private $secureRandom; |
|
40 | - |
|
41 | - /** |
|
42 | - * TokenHandler constructor. |
|
43 | - * |
|
44 | - * @param ISecureRandom $secureRandom |
|
45 | - */ |
|
46 | - public function __construct(ISecureRandom $secureRandom) { |
|
47 | - $this->secureRandom = $secureRandom; |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * generate to token used to authenticate federated shares |
|
52 | - * |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - public function generateToken() { |
|
56 | - $token = $this->secureRandom->generate( |
|
57 | - self::TOKEN_LENGTH, |
|
58 | - ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); |
|
59 | - return $token; |
|
60 | - } |
|
36 | + const TOKEN_LENGTH = 15; |
|
37 | + |
|
38 | + /** @var ISecureRandom */ |
|
39 | + private $secureRandom; |
|
40 | + |
|
41 | + /** |
|
42 | + * TokenHandler constructor. |
|
43 | + * |
|
44 | + * @param ISecureRandom $secureRandom |
|
45 | + */ |
|
46 | + public function __construct(ISecureRandom $secureRandom) { |
|
47 | + $this->secureRandom = $secureRandom; |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * generate to token used to authenticate federated shares |
|
52 | + * |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + public function generateToken() { |
|
56 | + $token = $this->secureRandom->generate( |
|
57 | + self::TOKEN_LENGTH, |
|
58 | + ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); |
|
59 | + return $token; |
|
60 | + } |
|
61 | 61 | |
62 | 62 | } |
@@ -28,10 +28,10 @@ |
||
28 | 28 | <?php if((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
29 | 29 | <span class="status success"></span> |
30 | 30 | <?php |
31 | - } elseif( |
|
32 | - (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
33 | - (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
34 | - ) { ?> |
|
31 | + } elseif( |
|
32 | + (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
33 | + (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
34 | + ) { ?> |
|
35 | 35 | <span class="status indeterminate"></span> |
36 | 36 | <?php } else {?> |
37 | 37 | <span class="status error"></span> |
@@ -29,41 +29,41 @@ |
||
29 | 29 | |
30 | 30 | class Admin implements ISettings { |
31 | 31 | |
32 | - /** @var TrustedServers */ |
|
33 | - private $trustedServers; |
|
32 | + /** @var TrustedServers */ |
|
33 | + private $trustedServers; |
|
34 | 34 | |
35 | - public function __construct(TrustedServers $trustedServers) { |
|
36 | - $this->trustedServers = $trustedServers; |
|
37 | - } |
|
35 | + public function __construct(TrustedServers $trustedServers) { |
|
36 | + $this->trustedServers = $trustedServers; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @return TemplateResponse |
|
41 | - */ |
|
42 | - public function getForm() { |
|
43 | - $parameters = [ |
|
44 | - 'trustedServers' => $this->trustedServers->getServers(), |
|
45 | - 'autoAddServers' => $this->trustedServers->getAutoAddServers(), |
|
46 | - ]; |
|
39 | + /** |
|
40 | + * @return TemplateResponse |
|
41 | + */ |
|
42 | + public function getForm() { |
|
43 | + $parameters = [ |
|
44 | + 'trustedServers' => $this->trustedServers->getServers(), |
|
45 | + 'autoAddServers' => $this->trustedServers->getAutoAddServers(), |
|
46 | + ]; |
|
47 | 47 | |
48 | - return new TemplateResponse('federation', 'settings-admin', $parameters, ''); |
|
49 | - } |
|
48 | + return new TemplateResponse('federation', 'settings-admin', $parameters, ''); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @return string the section ID, e.g. 'sharing' |
|
53 | - */ |
|
54 | - public function getSection() { |
|
55 | - return 'sharing'; |
|
56 | - } |
|
51 | + /** |
|
52 | + * @return string the section ID, e.g. 'sharing' |
|
53 | + */ |
|
54 | + public function getSection() { |
|
55 | + return 'sharing'; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @return int whether the form should be rather on the top or bottom of |
|
60 | - * the admin section. The forms are arranged in ascending order of the |
|
61 | - * priority values. It is required to return a value between 0 and 100. |
|
62 | - * |
|
63 | - * E.g.: 70 |
|
64 | - */ |
|
65 | - public function getPriority() { |
|
66 | - return 30; |
|
67 | - } |
|
58 | + /** |
|
59 | + * @return int whether the form should be rather on the top or bottom of |
|
60 | + * the admin section. The forms are arranged in ascending order of the |
|
61 | + * priority values. It is required to return a value between 0 and 100. |
|
62 | + * |
|
63 | + * E.g.: 70 |
|
64 | + */ |
|
65 | + public function getPriority() { |
|
66 | + return 30; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | } |