1414use ByJG \Authenticate \Model \UserPropertiesModel ;
1515use ByJG \JwtWrapper \JwtWrapper ;
1616use ByJG \JwtWrapper \JwtWrapperException ;
17+ use ByJG \MicroOrm \Literal \HexUuidLiteral ;
18+ use ByJG \Serializer \Exception \InvalidArgumentException ;
1719
1820/**
1921 * Base implementation to search and handle users in XMLNuke.
@@ -84,7 +86,7 @@ public function addUser(string $name, string $userName, string $email, string $p
8486 * @param UserModel $model
8587 * @return bool
8688 * @throws UserExistsException
87- * @throws \ByJG\Serializer\Exception\ InvalidArgumentException
89+ * @throws InvalidArgumentException
8890 */
8991 public function canAddUser (UserModel $ model ): bool
9092 {
@@ -115,7 +117,7 @@ abstract public function getUser(IteratorFilter $filter): UserModel|null;
115117 *
116118 * @param string $email
117119 * @return UserModel|null
118- * @throws \ByJG\Serializer\Exception\ InvalidArgumentException
120+ * @throws InvalidArgumentException
119121 */
120122 public function getByEmail (string $ email ): UserModel |null
121123 {
@@ -130,7 +132,7 @@ public function getByEmail(string $email): UserModel|null
130132 *
131133 * @param string $username
132134 * @return UserModel|null
133- * @throws \ByJG\Serializer\Exception\ InvalidArgumentException
135+ * @throws InvalidArgumentException
134136 */
135137 public function getByUsername (string $ username ): UserModel |null
136138 {
@@ -158,11 +160,11 @@ public function getByLoginField(string $login): UserModel|null
158160 * Get the user based on his id.
159161 * Return Row if user was found; null, otherwise
160162 *
161- * @param string $userid
163+ * @param string|HexUuidLiteral|int $userid
162164 * @return UserModel|null
163- * @throws \ByJG\Serializer\Exception\ InvalidArgumentException
165+ * @throws InvalidArgumentException
164166 */
165- public function getById (string $ userid ): UserModel |null
167+ public function getById (string | HexUuidLiteral | int $ userid ): UserModel |null
166168 {
167169 $ filter = new IteratorFilter ();
168170 $ filter ->and ($ this ->getUserDefinition ()->getUserid (), Relation::EQUAL , $ userid );
@@ -184,7 +186,7 @@ abstract public function removeByLoginField(string $login): bool;
184186 * @param string $userName User login
185187 * @param string $password Plain text password
186188 * @return UserModel|null
187- * @throws \ByJG\Serializer\Exception\ InvalidArgumentException
189+ * @throws InvalidArgumentException
188190 */
189191 public function isValidUser (string $ userName , string $ password ): UserModel |null
190192 {
@@ -203,14 +205,14 @@ public function isValidUser(string $userName, string $password): UserModel|null
203205 * Check if the user have a property and it has a specific value.
204206 * Return True if you have rights; false, otherwise
205207 *
206- * @param string $userId User identification
208+ * @param string|int|HexUuidLiteral|null $userId User identification
207209 * @param string $propertyName
208210 * @param string|null $value Property value
209211 * @return bool
210212 * @throws UserNotFoundException
211- * @throws \ByJG\Serializer\Exception\ InvalidArgumentException
213+ * @throws InvalidArgumentException
212214 */
213- public function hasProperty (string $ userId , string $ propertyName , string $ value = null ): bool
215+ public function hasProperty (string | int | HexUuidLiteral | null $ userId , string $ propertyName , string $ value = null ): bool
214216 {
215217 //anydataset.Row
216218 $ user = $ this ->getById ($ userId );
@@ -240,13 +242,13 @@ public function hasProperty(string $userId, string $propertyName, string $value
240242 * Return all sites from a specific user
241243 * Return String vector with all sites
242244 *
243- * @param string $userId User ID
245+ * @param string|int|HexUuidLiteral $userId User ID
244246 * @param string $propertyName Property name
245247 * @return array|string|UserPropertiesModel|null
246248 * @throws UserNotFoundException
247- * @throws \ByJG\Serializer\Exception\ InvalidArgumentException
249+ * @throws InvalidArgumentException
248250 */
249- public function getProperty (string $ userId , string $ propertyName ): array |string |UserPropertiesModel |null
251+ public function getProperty (string | HexUuidLiteral | int $ userId , string $ propertyName ): array |string |UserPropertiesModel |null
250252 {
251253 $ user = $ this ->getById ($ userId );
252254 if ($ user !== null ) {
@@ -268,22 +270,22 @@ abstract public function getUsersByPropertySet(array $propertiesArray): array;
268270
269271 /**
270272 *
271- * @param string $userId
273+ * @param string|int|HexUuidLiteral $userId
272274 * @param string $propertyName
273275 * @param string|null $value
274276 */
275- abstract public function addProperty (string $ userId , string $ propertyName , string |null $ value ): bool ;
277+ abstract public function addProperty (string | HexUuidLiteral | int $ userId , string $ propertyName , string |null $ value ): bool ;
276278
277279 /**
278280 * Remove a specific site from user
279281 * Return True or false
280282 *
281- * @param string $userId User login
283+ * @param string|int|HexUuidLiteral $userId User login
282284 * @param string $propertyName Property name
283285 * @param string|null $value Property value with a site
284286 * @return bool
285287 * */
286- abstract public function removeProperty (string $ userId , string $ propertyName , string |null $ value = null ): bool ;
288+ abstract public function removeProperty (string | HexUuidLiteral | int $ userId , string $ propertyName , string |null $ value = null ): bool ;
287289
288290 /**
289291 * Remove a specific site from all users
@@ -296,12 +298,12 @@ abstract public function removeProperty(string $userId, string $propertyName, st
296298 abstract public function removeAllProperties (string $ propertyName , string |null $ value = null ): void ;
297299
298300 /**
299- * @param string $userId
301+ * @param string|int|HexUuidLiteral $userId
300302 * @return bool
301303 * @throws UserNotFoundException
302- * @throws \ByJG\Serializer\Exception\ InvalidArgumentException
304+ * @throws InvalidArgumentException
303305 */
304- public function isAdmin (string $ userId ): bool
306+ public function isAdmin (string | HexUuidLiteral | int $ userId ): bool
305307 {
306308 $ user = $ this ->getById ($ userId );
307309
@@ -325,7 +327,7 @@ public function isAdmin(string $userId): bool
325327 * @param array $updateTokenInfo
326328 * @return string|null the TOKEN or false if you don't.
327329 * @throws UserNotFoundException
328- * @throws \ByJG\Serializer\Exception\ InvalidArgumentException
330+ * @throws InvalidArgumentException
329331 */
330332 public function createAuthToken (
331333 string $ login ,
@@ -394,7 +396,7 @@ public function isValidToken(string $login, JwtWrapper $jwtWrapper, string $toke
394396 }
395397
396398 /**
397- * @param string $userid
399+ * @param string|int|HexUuidLiteral $userid
398400 */
399- abstract public function removeUserById (string $ userid ): bool ;
401+ abstract public function removeUserById (string | HexUuidLiteral | int $ userid ): bool ;
400402}
0 commit comments