Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions settings/Controller/ChangePasswordController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
*
*
Expand Down Expand Up @@ -26,12 +27,12 @@
*/
namespace OC\Settings\Controller;

use OC\Group\Manager as GroupManager;
use OC\HintException;
use OC\User\Session;
use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IUser;
Expand All @@ -49,7 +50,7 @@ class ChangePasswordController extends Controller {
/** @var IL10N */
private $l;

/** @var IGroupManager */
/** @var GroupManager */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just adding both here should work and we can still only request IGroupManager ?
Or why is it needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Else it can't resolve

$this->groupManager->getSubAdmin()->isUserAccessible($currentUser, $targetUser))
and phan keeps complaining.

I guess for Settings and Core it is fine to inject the non public ones. As we don't always want to expose everything.

private $groupManager;

/** @var Session */
Expand All @@ -58,24 +59,12 @@ class ChangePasswordController extends Controller {
/** @var IAppManager */
private $appManager;

/**
* ChangePasswordController constructor.
*
* @param string $appName
* @param IRequest $request
* @param $userId
* @param IUserManager $userManager
* @param IUserSession $userSession
* @param IGroupManager $groupManager
* @param IAppManager $appManager
* @param IL10N $l
*/
public function __construct($appName,
public function __construct(string $appName,
IRequest $request,
$userId,
string $userId,
IUserManager $userManager,
IUserSession $userSession,
IGroupManager $groupManager,
GroupManager $groupManager,
IAppManager $appManager,
IL10N $l) {
parent::__construct($appName, $request);
Expand All @@ -98,7 +87,7 @@ public function __construct($appName,
*
* @return JSONResponse
*/
public function changePersonalPassword($oldpassword = '', $newpassword = null) {
public function changePersonalPassword(string $oldpassword = '', string $newpassword = null): JSONResponse {
/** @var IUser $user */
$user = $this->userManager->checkPassword($this->userId, $oldpassword);
if ($user === false) {
Expand Down Expand Up @@ -148,7 +137,7 @@ public function changePersonalPassword($oldpassword = '', $newpassword = null) {
*
* @return JSONResponse
*/
public function changeUserPassword($username = null, $password = null, $recoveryPassword = null) {
public function changeUserPassword(string $username = null, string $password = null, string $recoveryPassword = null): JSONResponse {
if ($username === null) {
return new JSONResponse([
'status' => 'error',
Expand Down
Loading