Skip to content

Commit

Permalink
added(JwtAuth): 添加用户 和当前用户 Interface (#140)
Browse files Browse the repository at this point in the history
* added(JwtAuth): 添加用户 和当前用户 Interface

- 新增 CurrentUserInterface 和 UserInterface
- 定义了用户相关的方法和属性
- 为后续的用户认证和权限管理提供接口基础

* fix review

* fix cs-fix
  • Loading branch information
People-Sea authored Dec 21, 2024
1 parent ccfe015 commit 1e63d4f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/JwtAuth/Interfaces/CurrentUserInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);
/**
* This file is part of MineAdmin.
*
* @link https://www.mineadmin.com
* @document https://doc.mineadmin.com
* @contact [email protected]
* @license https://github.com/mineadmin/MineAdmin/blob/master/LICENSE
*/

namespace Mine\JwtAuth\Interfaces;

interface CurrentUserInterface
{
public function user(): ?UserInterface;

public function refresh(): array;

public function id(): int;

public function isSuperAdmin(): bool;
}
26 changes: 26 additions & 0 deletions src/JwtAuth/Interfaces/UserInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);
/**
* This file is part of MineAdmin.
*
* @link https://www.mineadmin.com
* @document https://doc.mineadmin.com
* @contact [email protected]
* @license https://github.com/mineadmin/MineAdmin/blob/master/LICENSE
*/

namespace Mine\JwtAuth\Interfaces;

use Hyperf\Database\Model\Relations\BelongsToMany;

interface UserInterface
{
public function roles(): BelongsToMany;

public function verifyPassword(string $password): bool;

public function resetPassword(): void;

public function isSuperAdmin(): bool;
}

0 comments on commit 1e63d4f

Please sign in to comment.