Completed
Push — master ( 24f1b8...24292b )
by Morris
137:15 queued 117:07
created

User::getDisplayNames()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016, ownCloud, Inc.
4
 *
5
 * @author Bart Visscher <[email protected]>
6
 * @author Björn Schießle <[email protected]>
7
 * @author Frank Karlitschek <[email protected]>
8
 * @author Georg Ehrke <[email protected]>
9
 * @author Joas Schilling <[email protected]>
10
 * @author Jörn Friedrich Dreyer <[email protected]>
11
 * @author Lukas Reschke <[email protected]>
12
 * @author Morris Jobke <[email protected]>
13
 * @author Robin McCorkell <[email protected]>
14
 * @author Sebastian Wessalowski <[email protected]>
15
 * @author Thomas Müller <[email protected]>
16
 *
17
 * @license AGPL-3.0
18
 *
19
 * This code is free software: you can redistribute it and/or modify
20
 * it under the terms of the GNU Affero General Public License, version 3,
21
 * as published by the Free Software Foundation.
22
 *
23
 * This program is distributed in the hope that it will be useful,
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
 * GNU Affero General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU Affero General Public License, version 3,
29
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
30
 *
31
 */
32
33
/**
34
 * Public interface of ownCloud for apps to use.
35
 * User Class
36
 *
37
 */
38
39
// use OCP namespace for all classes that are considered public.
40
// This means that they should be used by apps instead of the internal ownCloud classes
41
namespace OCP;
42
43
/**
44
 * This class provides access to the user management. You can get information
45
 * about the currently logged in user and the permissions for example
46
 * @since 5.0.0
47
 * @deprecated 13.0.0
48
 */
49
class User {
50
	/**
51
	 * Get the user id of the user currently logged in.
52
	 * @return string uid or false
53
	 * @deprecated 8.0.0 Use \OC::$server->getUserSession()->getUser()->getUID()
54
	 * @since 5.0.0
55
	 */
56
	public static function getUser() {
57
		return \OC_User::getUser();
58
	}
59
60
	/**
61
	 * Get a list of all users
62
	 * @param string $search search pattern
63
	 * @param int|null $limit
64
	 * @param int|null $offset
65
	 * @return array an array of all uids
66
	 * @deprecated 8.1.0 use method search() of \OCP\IUserManager - \OC::$server->getUserManager()
67
	 * @since 5.0.0
68
	 */
69
	public static function getUsers( $search = '', $limit = null, $offset = null ) {
70
		return \OC_User::getUsers( $search, $limit, $offset );
71
	}
72
73
	/**
74
	 * Get the user display name of the user currently logged in.
75
	 * @param string|null $user user id or null for current user
76
	 * @return string display name
77
	 * @deprecated 8.1.0 fetch \OCP\IUser (has getDisplayName()) by using method
78
	 *                   get() of \OCP\IUserManager - \OC::$server->getUserManager()
79
	 * @since 5.0.0
80
	 */
81
	public static function getDisplayName( $user = null ) {
82
		return \OC_User::getDisplayName( $user );
83
	}
84
85
	/**
86
	 * Check if the user is logged in
87
	 * @return boolean
88
	 * @since 5.0.0
89
	 * @deprecated 13.0.0 Use annotation based ACLs from the AppFramework instead
90
	 */
91
	public static function isLoggedIn() {
92
		return \OC::$server->getUserSession()->isLoggedIn();
93
	}
94
95
	/**
96
	 * Check if a user exists
97
	 * @param string $uid the username
98
	 * @param string $excludingBackend (default none)
99
	 * @return boolean
100
	 * @deprecated 8.1.0 use method userExists() of \OCP\IUserManager - \OC::$server->getUserManager()
101
	 * @since 5.0.0
102
	 */
103
	public static function userExists($uid, $excludingBackend = null) {
0 ignored issues
show
Unused Code introduced by
The parameter $excludingBackend is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
104
		return \OC::$server->getUserManager()->userExists($uid);
105
	}
106
107
	/**
108
	 * Check if the user is a admin, redirects to home if not
109
	 * @since 5.0.0
110
	 * @deprecated 13.0.0 Use annotation based ACLs from the AppFramework instead
111
	 */
112
	public static function checkAdminUser() {
113
		\OC_Util::checkAdminUser();
114
	}
115
116
	/**
117
	 * Check if the user is logged in, redirects to home if not. With
118
	 * redirect URL parameter to the request URI.
119
	 * @since 5.0.0
120
	 * @deprecated 13.0.0 Use annotation based ACLs from the AppFramework instead
121
	 */
122
	public static function checkLoggedIn() {
123
		\OC_Util::checkLoggedIn();
124
	}
125
}
126