fix : 권한관리 기능 추가 (각 기능 확인 필요)
- 메뉴관리 - 역할관리 - 부서관리 - 메뉴, 부서, 역할, 유저 - 권한 연동
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Models\Members;
|
||||
|
||||
use App\Models\Commons\Role;
|
||||
use App\Models\Commons\File;
|
||||
use App\Models\Tenants\Tenant;
|
||||
use App\Traits\ModelTrait;
|
||||
@@ -13,10 +12,15 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
use Spatie\Permission\Models\Role as SpatieRole;
|
||||
use App\Models\Commons\Role as CommonRole;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, Notifiable, SoftDeletes, ModelTrait, HasRoles;
|
||||
|
||||
protected $guard_name = 'api'; // ★ 중요: 권한/역할 가드 통일
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'name',
|
||||
@@ -56,9 +60,10 @@ public function userRoles()
|
||||
return $this->hasMany(UserRole::class);
|
||||
}
|
||||
|
||||
public function roles()
|
||||
public function orgRoles()
|
||||
{
|
||||
return $this->belongsToMany(Role::class, 'user_roles')->withPivot('tenant_id', 'assigned_at');
|
||||
return $this->belongsToMany(CommonRole::class, 'user_roles')
|
||||
->withPivot(['tenant_id', 'assigned_at']);
|
||||
}
|
||||
|
||||
public function userTenantById($tenantId)
|
||||
|
||||
Reference in New Issue
Block a user