Passed
Push — master ( a78624...b981cb )
by Christoph
14:14 queued 11s
created
lib/public/FullTextSearch/Service/ISearchService.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -45,45 +45,45 @@
 block discarded – undo
45 45
 interface ISearchService {
46 46
 
47 47
 
48
-	/**
49
-	 * generate a search request, based on an array:
50
-	 *
51
-	 * $request =
52
-	 *   [
53
-	 *        'providers' =>    (string/array) 'all'
54
-	 *        'author' =>       (string) owner of the document.
55
-	 *        'search' =>       (string) search string,
56
-	 *        'size' =>         (int) number of items to be return
57
-	 *        'page' =>         (int) page
58
-	 *        'parts' =>        (array) parts of document to search within,
59
-	 *        'options' =       (array) search options,
60
-	 *        'tags'     =>     (array) tags,
61
-	 *        'metatags' =>     (array) metatags,
62
-	 *        'subtags'  =>     (array) subtags
63
-	 *   ]
64
-	 *
65
-	 * 'providers' can be an array of providerIds
66
-	 *
67
-	 * @since 15.0.0
68
-	 *
69
-	 * @param array $request
70
-	 *
71
-	 * @return ISearchRequest
72
-	 */
73
-	public function generateSearchRequest(array $request): ISearchRequest;
48
+    /**
49
+     * generate a search request, based on an array:
50
+     *
51
+     * $request =
52
+     *   [
53
+     *        'providers' =>    (string/array) 'all'
54
+     *        'author' =>       (string) owner of the document.
55
+     *        'search' =>       (string) search string,
56
+     *        'size' =>         (int) number of items to be return
57
+     *        'page' =>         (int) page
58
+     *        'parts' =>        (array) parts of document to search within,
59
+     *        'options' =       (array) search options,
60
+     *        'tags'     =>     (array) tags,
61
+     *        'metatags' =>     (array) metatags,
62
+     *        'subtags'  =>     (array) subtags
63
+     *   ]
64
+     *
65
+     * 'providers' can be an array of providerIds
66
+     *
67
+     * @since 15.0.0
68
+     *
69
+     * @param array $request
70
+     *
71
+     * @return ISearchRequest
72
+     */
73
+    public function generateSearchRequest(array $request): ISearchRequest;
74 74
 
75 75
 
76
-	/**
77
-	 * Search documents
78
-	 *
79
-	 * @since 15.0.0
80
-	 *
81
-	 * @param string $userId
82
-	 * @param ISearchRequest $searchRequest
83
-	 *
84
-	 * @return ISearchResult[]
85
-	 */
86
-	public function search(string $userId, ISearchRequest $searchRequest): array;
76
+    /**
77
+     * Search documents
78
+     *
79
+     * @since 15.0.0
80
+     *
81
+     * @param string $userId
82
+     * @param ISearchRequest $searchRequest
83
+     *
84
+     * @return ISearchResult[]
85
+     */
86
+    public function search(string $userId, ISearchRequest $searchRequest): array;
87 87
 
88 88
 }
89 89
 
Please login to merge, or discard this patch.
lib/public/FullTextSearch/Model/IIndexOptions.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -46,41 +46,41 @@
 block discarded – undo
46 46
 interface IIndexOptions {
47 47
 
48 48
 
49
-	/**
50
-	 * Get the value (as a string) for an option.
51
-	 *
52
-	 * @since 15.0.0
53
-	 *
54
-	 * @param string $option
55
-	 * @param string $default
56
-	 *
57
-	 * @return string
58
-	 */
59
-	public function getOption(string $option, string $default = ''): string;
49
+    /**
50
+     * Get the value (as a string) for an option.
51
+     *
52
+     * @since 15.0.0
53
+     *
54
+     * @param string $option
55
+     * @param string $default
56
+     *
57
+     * @return string
58
+     */
59
+    public function getOption(string $option, string $default = ''): string;
60 60
 
61
-	/**
62
-	 * Get the value (as an array) for an option.
63
-	 *
64
-	 * @since 15.0.0
65
-	 *
66
-	 * @param string $option
67
-	 * @param array $default
68
-	 *
69
-	 * @return array
70
-	 */
71
-	public function getOptionArray(string $option, array $default = []): array;
61
+    /**
62
+     * Get the value (as an array) for an option.
63
+     *
64
+     * @since 15.0.0
65
+     *
66
+     * @param string $option
67
+     * @param array $default
68
+     *
69
+     * @return array
70
+     */
71
+    public function getOptionArray(string $option, array $default = []): array;
72 72
 
73
-	/**
74
-	 * Get the value (as an boolean) for an option.
75
-	 *
76
-	 * @since 15.0.0
77
-	 *
78
-	 * @param string $option
79
-	 * @param bool $default
80
-	 *
81
-	 * @return bool
82
-	 */
83
-	public function getOptionBool(string $option, bool $default): bool;
73
+    /**
74
+     * Get the value (as an boolean) for an option.
75
+     *
76
+     * @since 15.0.0
77
+     *
78
+     * @param string $option
79
+     * @param bool $default
80
+     *
81
+     * @return bool
82
+     */
83
+    public function getOptionBool(string $option, bool $default): bool;
84 84
 
85 85
 }
86 86
 
Please login to merge, or discard this patch.
lib/private/Authentication/Exceptions/ExpiredTokenException.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@
 block discarded – undo
26 26
 use OC\Authentication\Token\IToken;
27 27
 
28 28
 class ExpiredTokenException extends InvalidTokenException {
29
-	/** @var IToken */
30
-	private $token;
29
+    /** @var IToken */
30
+    private $token;
31 31
 
32
-	public function __construct(IToken $token) {
33
-		parent::__construct();
32
+    public function __construct(IToken $token) {
33
+        parent::__construct();
34 34
 
35
-		$this->token = $token;
36
-	}
35
+        $this->token = $token;
36
+    }
37 37
 
38
-	public function getToken(): IToken {
39
-		return $this->token;
40
-	}
38
+    public function getToken(): IToken {
39
+        return $this->token;
40
+    }
41 41
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Versions/IVersionManager.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
25 25
  * @since 15.0.0
26 26
  */
27 27
 interface IVersionManager extends IVersionBackend {
28
-	/**
29
-	 * Register a new backend
30
-	 *
31
-	 * @param string $storageType
32
-	 * @param IVersionBackend $backend
33
-	 * @since 15.0.0
34
-	 */
35
-	public function registerBackend(string $storageType, IVersionBackend $backend);
28
+    /**
29
+     * Register a new backend
30
+     *
31
+     * @param string $storageType
32
+     * @param IVersionBackend $backend
33
+     * @since 15.0.0
34
+     */
35
+    public function registerBackend(string $storageType, IVersionBackend $backend);
36 36
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Sabre/RootCollection.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -33,52 +33,52 @@
 block discarded – undo
33 33
 
34 34
 class RootCollection extends AbstractPrincipalCollection {
35 35
 
36
-	/** @var IRootFolder */
37
-	private $rootFolder;
36
+    /** @var IRootFolder */
37
+    private $rootFolder;
38 38
 
39
-	/** @var IUserManager */
40
-	private $userManager;
39
+    /** @var IUserManager */
40
+    private $userManager;
41 41
 
42
-	/** @var IVersionManager */
43
-	private $versionManager;
42
+    /** @var IVersionManager */
43
+    private $versionManager;
44 44
 
45
-	public function __construct(
46
-		PrincipalBackend\BackendInterface $principalBackend,
47
-		IRootFolder $rootFolder,
48
-		IConfig $config,
49
-		IUserManager $userManager,
50
-		IVersionManager $versionManager
51
-	) {
52
-		parent::__construct($principalBackend, 'principals/users');
45
+    public function __construct(
46
+        PrincipalBackend\BackendInterface $principalBackend,
47
+        IRootFolder $rootFolder,
48
+        IConfig $config,
49
+        IUserManager $userManager,
50
+        IVersionManager $versionManager
51
+    ) {
52
+        parent::__construct($principalBackend, 'principals/users');
53 53
 
54
-		$this->rootFolder = $rootFolder;
55
-		$this->userManager = $userManager;
56
-		$this->versionManager = $versionManager;
54
+        $this->rootFolder = $rootFolder;
55
+        $this->userManager = $userManager;
56
+        $this->versionManager = $versionManager;
57 57
 
58
-		$this->disableListing = !$config->getSystemValue('debug', false);
59
-	}
58
+        $this->disableListing = !$config->getSystemValue('debug', false);
59
+    }
60 60
 
61
-	/**
62
-	 * This method returns a node for a principal.
63
-	 *
64
-	 * The passed array contains principal information, and is guaranteed to
65
-	 * at least contain a uri item. Other properties may or may not be
66
-	 * supplied by the authentication backend.
67
-	 *
68
-	 * @param array $principalInfo
69
-	 * @return INode
70
-	 */
71
-	public function getChildForPrincipal(array $principalInfo) {
72
-		list(, $name) = \Sabre\Uri\split($principalInfo['uri']);
73
-		$user = \OC::$server->getUserSession()->getUser();
74
-		if (is_null($user) || $name !== $user->getUID()) {
75
-			throw new \Sabre\DAV\Exception\Forbidden();
76
-		}
77
-		return new VersionHome($principalInfo, $this->rootFolder, $this->userManager, $this->versionManager);
78
-	}
61
+    /**
62
+     * This method returns a node for a principal.
63
+     *
64
+     * The passed array contains principal information, and is guaranteed to
65
+     * at least contain a uri item. Other properties may or may not be
66
+     * supplied by the authentication backend.
67
+     *
68
+     * @param array $principalInfo
69
+     * @return INode
70
+     */
71
+    public function getChildForPrincipal(array $principalInfo) {
72
+        list(, $name) = \Sabre\Uri\split($principalInfo['uri']);
73
+        $user = \OC::$server->getUserSession()->getUser();
74
+        if (is_null($user) || $name !== $user->getUID()) {
75
+            throw new \Sabre\DAV\Exception\Forbidden();
76
+        }
77
+        return new VersionHome($principalInfo, $this->rootFolder, $this->userManager, $this->versionManager);
78
+    }
79 79
 
80
-	public function getName() {
81
-		return 'versions';
82
-	}
80
+    public function getName() {
81
+        return 'versions';
82
+    }
83 83
 
84 84
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Sabre/VersionRoot.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -33,74 +33,74 @@
 block discarded – undo
33 33
 
34 34
 class VersionRoot implements ICollection {
35 35
 
36
-	/** @var IUser */
37
-	private $user;
36
+    /** @var IUser */
37
+    private $user;
38 38
 
39
-	/** @var IRootFolder */
40
-	private $rootFolder;
39
+    /** @var IRootFolder */
40
+    private $rootFolder;
41 41
 
42
-	/** @var IVersionManager */
43
-	private $versionManager;
42
+    /** @var IVersionManager */
43
+    private $versionManager;
44 44
 
45
-	public function __construct(IUser $user, IRootFolder $rootFolder, IVersionManager $versionManager) {
46
-		$this->user = $user;
47
-		$this->rootFolder = $rootFolder;
48
-		$this->versionManager = $versionManager;
49
-	}
45
+    public function __construct(IUser $user, IRootFolder $rootFolder, IVersionManager $versionManager) {
46
+        $this->user = $user;
47
+        $this->rootFolder = $rootFolder;
48
+        $this->versionManager = $versionManager;
49
+    }
50 50
 
51
-	public function delete() {
52
-		throw new Forbidden();
53
-	}
51
+    public function delete() {
52
+        throw new Forbidden();
53
+    }
54 54
 
55
-	public function getName(): string {
56
-		return 'versions';
57
-	}
55
+    public function getName(): string {
56
+        return 'versions';
57
+    }
58 58
 
59
-	public function setName($name) {
60
-		throw new Forbidden();
61
-	}
59
+    public function setName($name) {
60
+        throw new Forbidden();
61
+    }
62 62
 
63
-	public function createFile($name, $data = null) {
64
-		throw new Forbidden();
65
-	}
63
+    public function createFile($name, $data = null) {
64
+        throw new Forbidden();
65
+    }
66 66
 
67
-	public function createDirectory($name) {
68
-		throw new Forbidden();
69
-	}
67
+    public function createDirectory($name) {
68
+        throw new Forbidden();
69
+    }
70 70
 
71
-	public function getChild($name) {
72
-		$userFolder = $this->rootFolder->getUserFolder($this->user->getUID());
71
+    public function getChild($name) {
72
+        $userFolder = $this->rootFolder->getUserFolder($this->user->getUID());
73 73
 
74
-		$fileId = (int)$name;
75
-		$nodes = $userFolder->getById($fileId);
74
+        $fileId = (int)$name;
75
+        $nodes = $userFolder->getById($fileId);
76 76
 
77
-		if ($nodes === []) {
78
-			throw new NotFound();
79
-		}
77
+        if ($nodes === []) {
78
+            throw new NotFound();
79
+        }
80 80
 
81
-		$node = array_pop($nodes);
81
+        $node = array_pop($nodes);
82 82
 
83
-		if (!$node instanceof File) {
84
-			throw new NotFound();
85
-		}
83
+        if (!$node instanceof File) {
84
+            throw new NotFound();
85
+        }
86 86
 
87
-		return new VersionCollection($userFolder, $node, $this->user, $this->versionManager);
88
-	}
87
+        return new VersionCollection($userFolder, $node, $this->user, $this->versionManager);
88
+    }
89 89
 
90
-	public function getChildren(): array {
91
-		return [];
92
-	}
90
+    public function getChildren(): array {
91
+        return [];
92
+    }
93 93
 
94
-	public function childExists($name): bool {
95
-		try {
96
-			$this->getChild($name);
97
-			return true;
98
-		} catch (NotFound $e) {
99
-			return false;
100
-		}
101
-	}
94
+    public function childExists($name): bool {
95
+        try {
96
+            $this->getChild($name);
97
+            return true;
98
+        } catch (NotFound $e) {
99
+            return false;
100
+        }
101
+    }
102 102
 
103
-	public function getLastModified(): int {
104
-		return 0;
105
-	}
103
+    public function getLastModified(): int {
104
+        return 0;
105
+    }
106 106
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Sabre/VersionCollection.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -35,76 +35,76 @@
 block discarded – undo
35 35
 use Sabre\DAV\ICollection;
36 36
 
37 37
 class VersionCollection implements ICollection {
38
-	/** @var Folder */
39
-	private $userFolder;
40
-
41
-	/** @var File */
42
-	private $file;
43
-
44
-	/** @var IUser */
45
-	private $user;
46
-
47
-	/** @var IVersionManager */
48
-	private $versionManager;
49
-
50
-	public function __construct(Folder $userFolder, File $file, IUser $user, IVersionManager $versionManager) {
51
-		$this->userFolder = $userFolder;
52
-		$this->file = $file;
53
-		$this->user = $user;
54
-		$this->versionManager = $versionManager;
55
-	}
56
-
57
-	public function createFile($name, $data = null) {
58
-		throw new Forbidden();
59
-	}
60
-
61
-	public function createDirectory($name) {
62
-		throw new Forbidden();
63
-	}
64
-
65
-	public function getChild($name) {
66
-		/** @var VersionFile[] $versions */
67
-		$versions = $this->getChildren();
68
-
69
-		foreach ($versions as $version) {
70
-			if ($version->getName() === $name) {
71
-				return $version;
72
-			}
73
-		}
74
-
75
-		throw new NotFound();
76
-	}
77
-
78
-	public function getChildren(): array {
79
-		$versions = $this->versionManager->getVersionsForFile($this->user, $this->file);
80
-
81
-		return array_map(function (IVersion $version) {
82
-			return new VersionFile($version, $this->versionManager);
83
-		}, $versions);
84
-	}
85
-
86
-	public function childExists($name): bool {
87
-		try {
88
-			$this->getChild($name);
89
-			return true;
90
-		} catch (NotFound $e) {
91
-			return false;
92
-		}
93
-	}
94
-
95
-	public function delete() {
96
-		throw new Forbidden();
97
-	}
98
-
99
-	public function getName(): string {
100
-		return (string)$this->file->getId();
101
-	}
102
-
103
-	public function setName($name) {
104
-		throw new Forbidden();
105
-	}
106
-
107
-	public function getLastModified(): int {
108
-		return 0;
109
-	}
38
+    /** @var Folder */
39
+    private $userFolder;
40
+
41
+    /** @var File */
42
+    private $file;
43
+
44
+    /** @var IUser */
45
+    private $user;
46
+
47
+    /** @var IVersionManager */
48
+    private $versionManager;
49
+
50
+    public function __construct(Folder $userFolder, File $file, IUser $user, IVersionManager $versionManager) {
51
+        $this->userFolder = $userFolder;
52
+        $this->file = $file;
53
+        $this->user = $user;
54
+        $this->versionManager = $versionManager;
55
+    }
56
+
57
+    public function createFile($name, $data = null) {
58
+        throw new Forbidden();
59
+    }
60
+
61
+    public function createDirectory($name) {
62
+        throw new Forbidden();
63
+    }
64
+
65
+    public function getChild($name) {
66
+        /** @var VersionFile[] $versions */
67
+        $versions = $this->getChildren();
68
+
69
+        foreach ($versions as $version) {
70
+            if ($version->getName() === $name) {
71
+                return $version;
72
+            }
73
+        }
74
+
75
+        throw new NotFound();
76
+    }
77
+
78
+    public function getChildren(): array {
79
+        $versions = $this->versionManager->getVersionsForFile($this->user, $this->file);
80
+
81
+        return array_map(function (IVersion $version) {
82
+            return new VersionFile($version, $this->versionManager);
83
+        }, $versions);
84
+    }
85
+
86
+    public function childExists($name): bool {
87
+        try {
88
+            $this->getChild($name);
89
+            return true;
90
+        } catch (NotFound $e) {
91
+            return false;
92
+        }
93
+    }
94
+
95
+    public function delete() {
96
+        throw new Forbidden();
97
+    }
98
+
99
+    public function getName(): string {
100
+        return (string)$this->file->getId();
101
+    }
102
+
103
+    public function setName($name) {
104
+        throw new Forbidden();
105
+    }
106
+
107
+    public function getLastModified(): int {
108
+        return 0;
109
+    }
110 110
 }
Please login to merge, or discard this patch.
private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -32,60 +32,60 @@
 block discarded – undo
32 32
 use OCP\User\Backend\IPasswordConfirmationBackend;
33 33
 
34 34
 class PasswordConfirmationMiddleware extends Middleware {
35
-	/** @var ControllerMethodReflector */
36
-	private $reflector;
37
-	/** @var ISession */
38
-	private $session;
39
-	/** @var IUserSession */
40
-	private $userSession;
41
-	/** @var ITimeFactory */
42
-	private $timeFactory;
43
-	/** @var array */
44
-	private $excludedUserBackEnds = ['user_saml' => true, 'user_globalsiteselector' => true];
35
+    /** @var ControllerMethodReflector */
36
+    private $reflector;
37
+    /** @var ISession */
38
+    private $session;
39
+    /** @var IUserSession */
40
+    private $userSession;
41
+    /** @var ITimeFactory */
42
+    private $timeFactory;
43
+    /** @var array */
44
+    private $excludedUserBackEnds = ['user_saml' => true, 'user_globalsiteselector' => true];
45 45
 
46
-	/**
47
-	 * PasswordConfirmationMiddleware constructor.
48
-	 *
49
-	 * @param ControllerMethodReflector $reflector
50
-	 * @param ISession $session
51
-	 * @param IUserSession $userSession
52
-	 * @param ITimeFactory $timeFactory
53
-	 */
54
-	public function __construct(ControllerMethodReflector $reflector,
55
-								ISession $session,
56
-								IUserSession $userSession,
57
-								ITimeFactory $timeFactory) {
58
-		$this->reflector = $reflector;
59
-		$this->session = $session;
60
-		$this->userSession = $userSession;
61
-		$this->timeFactory = $timeFactory;
62
-	}
46
+    /**
47
+     * PasswordConfirmationMiddleware constructor.
48
+     *
49
+     * @param ControllerMethodReflector $reflector
50
+     * @param ISession $session
51
+     * @param IUserSession $userSession
52
+     * @param ITimeFactory $timeFactory
53
+     */
54
+    public function __construct(ControllerMethodReflector $reflector,
55
+                                ISession $session,
56
+                                IUserSession $userSession,
57
+                                ITimeFactory $timeFactory) {
58
+        $this->reflector = $reflector;
59
+        $this->session = $session;
60
+        $this->userSession = $userSession;
61
+        $this->timeFactory = $timeFactory;
62
+    }
63 63
 
64
-	/**
65
-	 * @param Controller $controller
66
-	 * @param string $methodName
67
-	 * @throws NotConfirmedException
68
-	 */
69
-	public function beforeController($controller, $methodName) {
70
-		if ($this->reflector->hasAnnotation('PasswordConfirmationRequired')) {
71
-			$user = $this->userSession->getUser();
72
-			$backendClassName = '';
73
-			if ($user !== null) {
74
-				$backend = $user->getBackend();
75
-				if ($backend instanceof IPasswordConfirmationBackend) {
76
-					if (!$backend->canConfirmPassword($user->getUID())) {
77
-						return;
78
-					}
79
-				}
64
+    /**
65
+     * @param Controller $controller
66
+     * @param string $methodName
67
+     * @throws NotConfirmedException
68
+     */
69
+    public function beforeController($controller, $methodName) {
70
+        if ($this->reflector->hasAnnotation('PasswordConfirmationRequired')) {
71
+            $user = $this->userSession->getUser();
72
+            $backendClassName = '';
73
+            if ($user !== null) {
74
+                $backend = $user->getBackend();
75
+                if ($backend instanceof IPasswordConfirmationBackend) {
76
+                    if (!$backend->canConfirmPassword($user->getUID())) {
77
+                        return;
78
+                    }
79
+                }
80 80
 
81
-				$backendClassName = $user->getBackendClassName();
82
-			}
81
+                $backendClassName = $user->getBackendClassName();
82
+            }
83 83
 
84
-			$lastConfirm = (int) $this->session->get('last-password-confirm');
85
-			// we can't check the password against a SAML backend, so skip password confirmation in this case
86
-			if (!isset($this->excludedUserBackEnds[$backendClassName]) && $lastConfirm < ($this->timeFactory->getTime() - (30 * 60 + 15))) { // allow 15 seconds delay
87
-				throw new NotConfirmedException();
88
-			}
89
-		}
90
-	}
84
+            $lastConfirm = (int) $this->session->get('last-password-confirm');
85
+            // we can't check the password against a SAML backend, so skip password confirmation in this case
86
+            if (!isset($this->excludedUserBackEnds[$backendClassName]) && $lastConfirm < ($this->timeFactory->getTime() - (30 * 60 + 15))) { // allow 15 seconds delay
87
+                throw new NotConfirmedException();
88
+            }
89
+        }
90
+    }
91 91
 }
Please login to merge, or discard this patch.
lib/public/User/Backend/IPasswordConfirmationBackend.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@
 block discarded – undo
29 29
  */
30 30
 interface IPasswordConfirmationBackend {
31 31
 
32
-	/**
33
-	 * @since 15.0.0
34
-	 */
35
-	public function canConfirmPassword(string $uid): bool;
32
+    /**
33
+     * @since 15.0.0
34
+     */
35
+    public function canConfirmPassword(string $uid): bool;
36 36
 }
Please login to merge, or discard this patch.