Kullanıcıdan Rol Kaldır
Kullanıcıdan rol kaldırır.
Endpoint
POST /api/v1/users/remove-role
Authentication
Bu endpoint authentication gerektirir.
Header: Authorization: Bearer \{token\}
Permission
admin.manage- Admin yönetim işlemleriroles.revoke- Rol kaldırma
Request
Headers
| Header | Değer | Zorunlu |
|---|---|---|
Authorization | Bearer \{token\} | Evet |
Content-Type | application/json | Evet |
Request Body
| Parametre | Tip | Zorunlu | Açıklama |
|---|---|---|---|
user_id | integer | Evet* | Kullanıcı ID'si |
user_uuid | string | Evet* | Kullanıcı UUID'si |
role_id | integer | Evet* | Rol ID'si |
role_slug | string | Evet* | Rol slug'ı |
secret | string | Hayır | Sistem rolleri için gizli anahtar |
* user_id veya user_uuid'den biri, role_id veya role_slug'dan biri zorunludur.
Example Request
{
"user_uuid": "550e8400-e29b-41d4-a716-446655440000",
"role_slug": "mgmt.editor"
}
Response
Success Response (200 OK)
{
"id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"email": "user@example.com",
"roles": []
}
Error Responses
403 Forbidden
{
"message": "Rol kaldırma yetkiniz yok"
}
403 Forbidden (Sistem Rolleri)
{
"message": "Forbidden role removal"
}
403 Forbidden (Sistem Rolü Kontrolü)
{
"message": "You cannot remove roles from users with system roles"
}
Code Examples
cURL
curl -X POST https://api.example.com/api/v1/users/remove-role \
-H "Authorization: Bearer \{token\}" \
-H "Content-Type: application/json" \
-d '{
"user_uuid": "550e8400-e29b-41d4-a716-446655440000",
"role_slug": "mgmt.editor"
}'
Notes
- Sistem rolleri için
X-Role-Secretheader'ı veyasecretparametresi gereklidir - Sistem rolüne sahip kullanıcılardan rol kaldırılamaz
- Kullanıcı sadece kendi seviyesinden düşük seviyeli rolleri kaldırabilir
Related Endpoints
- Kullanıcıya Rol Ata - Kullanıcıya rol atama
- Kullanıcı Permission Listesi - Kullanıcının permission'larını listele