Prechádzať zdrojové kódy

Take IUser instead of User

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Lukas Reschke 7 rokov pred
rodič
commit
b4d4db0e39

+ 5 - 4
lib/private/Group/Group.php

@@ -29,6 +29,7 @@
 namespace OC\Group;
 
 use OCP\IGroup;
+use OCP\IUser;
 
 class Group implements IGroup {
 	/** @var null|string  */
@@ -119,10 +120,10 @@ class Group implements IGroup {
 	/**
 	 * check if a user is in the group
 	 *
-	 * @param \OC\User\User $user
+	 * @param IUser $user
 	 * @return bool
 	 */
-	public function inGroup($user) {
+	public function inGroup(IUser $user) {
 		if (isset($this->users[$user->getUID()])) {
 			return true;
 		}
@@ -138,9 +139,9 @@ class Group implements IGroup {
 	/**
 	 * add a user to the group
 	 *
-	 * @param \OC\User\User $user
+	 * @param IUser $user
 	 */
-	public function addUser($user) {
+	public function addUser(IUser $user) {
 		if ($this->inGroup($user)) {
 			return;
 		}

+ 4 - 4
lib/private/Group/Manager.php

@@ -246,10 +246,10 @@ class Manager extends PublicEmitter implements IGroupManager {
 	}
 
 	/**
-	 * @param \OC\User\User|null $user
+	 * @param IUser|null $user
 	 * @return \OC\Group\Group[]
 	 */
-	public function getUserGroups($user) {
+	public function getUserGroups(IUser $user= null) {
 		if (!$user instanceof IUser) {
 			return [];
 		}
@@ -303,10 +303,10 @@ class Manager extends PublicEmitter implements IGroupManager {
 
 	/**
 	 * get a list of group ids for a user
-	 * @param \OC\User\User $user
+	 * @param IUser $user
 	 * @return array with group ids
 	 */
-	public function getUserGroupIds($user) {
+	public function getUserGroupIds(IUser $user) {
 		return array_map(function($value) {
 			return (string) $value;
 		}, array_keys($this->getUserGroups($user)));

+ 2 - 2
lib/public/IGroup.php

@@ -60,7 +60,7 @@ interface IGroup {
 	 * @return bool
 	 * @since 8.0.0
 	 */
-	public function inGroup($user);
+	public function inGroup(IUser $user);
 
 	/**
 	 * add a user to the group
@@ -68,7 +68,7 @@ interface IGroup {
 	 * @param \OCP\IUser $user
 	 * @since 8.0.0
 	 */
-	public function addUser($user);
+	public function addUser(IUser $user);
 
 	/**
 	 * remove a user from the group

+ 2 - 2
lib/public/IGroupManager.php

@@ -100,14 +100,14 @@ interface IGroupManager {
 	 * @return \OCP\IGroup[]
 	 * @since 8.0.0
 	 */
-	public function getUserGroups($user);
+	public function getUserGroups(IUser $user = null);
 
 	/**
 	 * @param \OCP\IUser $user
 	 * @return array with group names
 	 * @since 8.0.0
 	 */
-	public function getUserGroupIds($user);
+	public function getUserGroupIds(IUser $user);
 
 	/**
 	 * get a list of all display names in a group