Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public override void ConfigureServices(ServiceConfigurationContext context)

options.ResourceValueProviders.Add<UserResourcePermissionValueProvider>();
options.ResourceValueProviders.Add<RoleResourcePermissionValueProvider>();
options.ResourceValueProviders.Add<ClientResourcePermissionValueProvider>();
});

Configure<AbpVirtualFileSystemOptions>(options =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override async Task<MultiplePermissionGrantResult> CheckAsync(PermissionV
var clientId = context.Principal?.FindFirst(AbpClaimTypes.ClientId)?.Value;
if (clientId == null)
{
return new MultiplePermissionGrantResult(permissionNames); ;
return new MultiplePermissionGrantResult(permissionNames);
}

using (CurrentTenant.Change(null))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security.Claims;

namespace Volo.Abp.Authorization.Permissions.Resources;

public class ClientResourcePermissionValueProvider : ResourcePermissionValueProvider
{
public const string ProviderName = "C";

public override string Name => ProviderName;

protected ICurrentTenant CurrentTenant { get; }

public ClientResourcePermissionValueProvider(IResourcePermissionStore resourcePermissionStore, ICurrentTenant currentTenant)
: base(resourcePermissionStore)
{
CurrentTenant = currentTenant;
}

public override async Task<PermissionGrantResult> CheckAsync(ResourcePermissionValueCheckContext context)
{
var clientId = context.Principal?.FindFirst(AbpClaimTypes.ClientId)?.Value;

if (clientId == null)
{
return PermissionGrantResult.Undefined;
}

using (CurrentTenant.Change(null))
{
return await ResourcePermissionStore.IsGrantedAsync(context.Permission.Name, context.ResourceName, context.ResourceKey, Name, clientId)
? PermissionGrantResult.Granted
: PermissionGrantResult.Undefined;
}
}

public override async Task<MultiplePermissionGrantResult> CheckAsync(ResourcePermissionValuesCheckContext context)
{
var permissionNames = context.Permissions.Select(x => x.Name).Distinct().ToArray();
Check.NotNullOrEmpty(permissionNames, nameof(permissionNames));

var clientId = context.Principal?.FindFirst(AbpClaimTypes.ClientId)?.Value;
if (clientId == null)
{
return new MultiplePermissionGrantResult(permissionNames);
}

using (CurrentTenant.Change(null))
{
return await ResourcePermissionStore.IsGrantedAsync(permissionNames, context.ResourceName, context.ResourceKey, Name, clientId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public virtual async Task<List<UserFinderResult>> SearchUserAsync(string filter,
{
page = page < 1 ? 1 : page;
var users = await IdentityUserRepository.GetListAsync(filter: filter, skipCount: (page - 1) * 10, maxResultCount: 10);
return users.Select(user => new UserFinderResult
return users.Select(x => new UserFinderResult
{
Id = user.Id,
UserName = user.UserName
Id = x.Id,
UserName = x.UserName
}).ToList();
}
}
Expand All @@ -49,10 +49,10 @@ public virtual async Task<List<RoleFinderResult>> SearchRoleAsync(string filter,
{
page = page < 1 ? 1 : page;
var roles = await IdentityRoleRepository.GetListAsync(filter: filter, skipCount: (page - 1) * 10, maxResultCount: 10);
return roles.Select(user => new RoleFinderResult
return roles.Select(x => new RoleFinderResult
{
Id = user.Id,
RoleName = user.Name
Id = x.Id,
RoleName = x.Name
}).ToList();
}
}
Expand All @@ -62,10 +62,10 @@ public virtual async Task<List<UserFinderResult>> SearchUserByIdsAsync(Guid[] id
using (IdentityUserRepository.DisableTracking())
{
var users = await IdentityUserRepository.GetListByIdsAsync(ids);
return users.Select(user => new UserFinderResult
return users.Select(x => new UserFinderResult
{
Id = user.Id,
UserName = user.UserName
Id = x.Id,
UserName = x.UserName
}).ToList();
}
}
Expand All @@ -75,10 +75,10 @@ public virtual async Task<List<RoleFinderResult>> SearchRoleByNamesAsync(string[
using (IdentityUserRepository.DisableTracking())
{
var roles = await IdentityRoleRepository.GetListAsync(names);
return roles.Select(user => new RoleFinderResult
return roles.Select(x => new RoleFinderResult
{
Id = user.Id,
RoleName = user.Name
Id = x.Id,
RoleName = x.Name
}).ToList();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public virtual async Task<List<ResourcePermissionProviderKeyInfo>> SearchAsync(s
return roles.Select(r => new ResourcePermissionProviderKeyInfo(r.RoleName, r.RoleName)).ToList();
}

public virtual async Task<List<ResourcePermissionProviderKeyInfo>> SearchAsync(string[] keys, CancellationToken cancellationToken = default)
public virtual Task<List<ResourcePermissionProviderKeyInfo>> SearchAsync(string[] keys, CancellationToken cancellationToken = default)
{
var roles = await UserRoleFinder.SearchRoleByNamesAsync(keys.Distinct().ToArray());
return roles.Select(r => new ResourcePermissionProviderKeyInfo(r.RoleName, r.RoleName)).ToList();
// Keys are role names
return Task.FromResult(keys.Select(x => new ResourcePermissionProviderKeyInfo(x, x)).ToList());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace Volo.Abp.IdentityServer.Clients;

public class ClientFinderResult
{
public Guid Id { get; set; }

public string ClientId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Volo.Abp.IdentityServer.Clients;

public interface IClientFinder
{
Task<List<ClientFinderResult>> SearchAsync(string filter, int page = 1);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Nom d'utilisateur ou mot de passe invalide!",
"InvalidAuthenticatorCode": "Code d'authentification invalide !",
"InvalidRecoveryCode": "Code de récupération invalide !",
"TheTargetUserIsNotLinkedToYou": "L'utilisateur cible n'est pas lié à vous!"
"TheTargetUserIsNotLinkedToYou": "L'utilisateur cible n'est pas lié à vous!",
"ClientResourcePermissionProviderKeyLookupService": "Client"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "اسم المستخدم أو كلمة المرور غير صالحة!",
"InvalidAuthenticatorCode": "كود المصدق غير صالح!",
"InvalidRecoveryCode": "رمز الاسترداد غير صالح!",
"TheTargetUserIsNotLinkedToYou": "المستخدم المستهدف غير مرتبط بك!"
"TheTargetUserIsNotLinkedToYou": "المستخدم المستهدف غير مرتبط بك!",
"ClientResourcePermissionProviderKeyLookupService": "العميل"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Neplatné uživatelské jméno či heslo!",
"InvalidAuthenticatorCode": "Neplatný ověřovací kód!",
"InvalidRecoveryCode": "Neplatný kód pro obnovení!",
"TheTargetUserIsNotLinkedToYou": "Cílový uživatel s vámi není spojen!"
"TheTargetUserIsNotLinkedToYou": "Cílový uživatel s vámi není spojen!",
"ClientResourcePermissionProviderKeyLookupService": "Klient"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Ungültiger Benutzername oder Passwort!",
"InvalidAuthenticatorCode": "Ungültiger Authentifizierungscode!",
"InvalidRecoveryCode": "Ungültiger Wiederherstellungscode!",
"TheTargetUserIsNotLinkedToYou": "Der Zielbenutzer ist nicht mit Ihnen verknüpft!"
"TheTargetUserIsNotLinkedToYou": "Der Zielbenutzer ist nicht mit Ihnen verknüpft!",
"ClientResourcePermissionProviderKeyLookupService": "Client"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"LoginIsNotAllowed": "Δεν επιτρέπεται να συνδεθείτε! Ο λογαριασμός σας είναι ανενεργός ή χρειάζεται να επιβεβαιώσετε το email/τον αριθμό τηλεφώνου σας.",
"InvalidUsername": "Μη έγκυρο όνομα ή κωδικός!",
"InvalidAuthenticatorCode": "Μη έγκυρος κωδικός ελέγχου ταυτότητας!",
"TheTargetUserIsNotLinkedToYou": "Ο χρήστης-στόχος δεν είναι συνδεδεμένος με εσάς!"
"TheTargetUserIsNotLinkedToYou": "Ο χρήστης-στόχος δεν είναι συνδεδεμένος με εσάς!",
"ClientResourcePermissionProviderKeyLookupService": "Πελάτης"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"InvalidUserNameOrPassword": "Invalid username or password!",
"LoginIsNotAllowed": "You are not allowed to login! Your account is inactive or needs to confirm your email/phone number.",
"InvalidUsername": "Invalid username or password!",
"TheTargetUserIsNotLinkedToYou": "The target user is not linked to you!"
"TheTargetUserIsNotLinkedToYou": "The target user is not linked to you!",
"ClientResourcePermissionProviderKeyLookupService": "Client"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Invalid username or password!",
"InvalidAuthenticatorCode": "Invalid authenticator code!",
"InvalidRecoveryCode": "Invalid recovery code!",
"TheTargetUserIsNotLinkedToYou": "The target user is not linked to you!"
"TheTargetUserIsNotLinkedToYou": "The target user is not linked to you!",
"ClientResourcePermissionProviderKeyLookupService": "Client"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Nombre de usuario icorrecto",
"InvalidAuthenticatorCode": "¡Código de autenticador no válido!",
"InvalidRecoveryCode": "¡Código de recuperación no válido!",
"TheTargetUserIsNotLinkedToYou": "El usuario de destino no está asociado a usted."
"TheTargetUserIsNotLinkedToYou": "El usuario de destino no está asociado a usted.",
"ClientResourcePermissionProviderKeyLookupService": "Cliente"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "نام کاربری یا رمز عبور نامعتبر!",
"InvalidAuthenticatorCode": "کد احراز هویت نامعتبر!",
"InvalidRecoveryCode": "کد بازیابی نامعتبر!",
"TheTargetUserIsNotLinkedToYou": "کاربر هدف به شما پیوند داده نشده است!"
"TheTargetUserIsNotLinkedToYou": "کاربر هدف به شما پیوند داده نشده است!",
"ClientResourcePermissionProviderKeyLookupService": "کلاینت"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Väärä käyttäjänimi tai salasana!",
"InvalidAuthenticatorCode": "Virheellinen todennuskoodi!",
"InvalidRecoveryCode": "Virheellinen palautuskoodi!",
"TheTargetUserIsNotLinkedToYou": "Kohdekäyttäjä ei ole linkitetty sinuun!"
"TheTargetUserIsNotLinkedToYou": "Kohdekäyttäjä ei ole linkitetty sinuun!",
"ClientResourcePermissionProviderKeyLookupService": "Asiakas"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "अमान्य उपयोगकर्ता नाम या पासवर्ड!",
"InvalidAuthenticatorCode": "अमान्य प्रमाणक कोड!",
"InvalidRecoveryCode": "अमान्य पुनर्प्राप्ति कोड!",
"TheTargetUserIsNotLinkedToYou": "लक्ष्य उपयोगकर्ता आपसे जुड़ा नहीं है!"
"TheTargetUserIsNotLinkedToYou": "लक्ष्य उपयोगकर्ता आपसे जुड़ा नहीं है!",
"ClientResourcePermissionProviderKeyLookupService": "क्लाइंट"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Neispravno korisničko ime ili lozinka!",
"InvalidAuthenticatorCode": "Nevažeći kod autentifikatora!",
"InvalidRecoveryCode": "Nevažeći kod za oporavak!",
"TheTargetUserIsNotLinkedToYou": "Ciljani korisnik nije povezan s vama!"
"TheTargetUserIsNotLinkedToYou": "Ciljani korisnik nije povezan s vama!",
"ClientResourcePermissionProviderKeyLookupService": "Klijent"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Érvénytelen felhasználónév vagy jelszó!",
"InvalidAuthenticatorCode": "Érvénytelen hitelesítő kód!",
"InvalidRecoveryCode": "Érvénytelen helyreállítási kód!",
"TheTargetUserIsNotLinkedToYou": "A célfelhasználó nincs hozzád kapcsolódva!"
"TheTargetUserIsNotLinkedToYou": "A célfelhasználó nincs hozzád kapcsolódva!",
"ClientResourcePermissionProviderKeyLookupService": "Kliens"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Ógilt notendanafn eða lykilorð!",
"InvalidAuthenticatorCode": "Ógildur auðkenningarkóði!",
"InvalidRecoveryCode": "Ógildur endurheimtarkóði!",
"TheTargetUserIsNotLinkedToYou": "Marknotandinn er ekki tengdur þér!"
"TheTargetUserIsNotLinkedToYou": "Marknotandinn er ekki tengdur þér!",
"ClientResourcePermissionProviderKeyLookupService": "Biðlari"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Username o password non validi!",
"InvalidAuthenticatorCode": "Codice autenticatore non valido!",
"InvalidRecoveryCode": "Codice di ripristino non valido!",
"TheTargetUserIsNotLinkedToYou": "L'utente indicato non è collegato a te!"
"TheTargetUserIsNotLinkedToYou": "L'utente indicato non è collegato a te!",
"ClientResourcePermissionProviderKeyLookupService": "Client"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Ongeldige gebruikersnaam of wachtwoord!",
"InvalidAuthenticatorCode": "Ongeldige authenticatiecode!",
"InvalidRecoveryCode": "Ongeldige herstelcode!",
"TheTargetUserIsNotLinkedToYou": "De beoogde gebruiker is niet aan jou gekoppeld!"
"TheTargetUserIsNotLinkedToYou": "De beoogde gebruiker is niet aan jou gekoppeld!",
"ClientResourcePermissionProviderKeyLookupService": "Client"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Nieprawidłowa nazwa użytkownika lub hasło!",
"InvalidAuthenticatorCode": "Nieprawidłowy kod uwierzytelniający!",
"InvalidRecoveryCode": "Nieprawidłowy kod odzyskiwania!",
"TheTargetUserIsNotLinkedToYou": "Docelowy użytkownik nie jest z Tobą powiązany!"
"TheTargetUserIsNotLinkedToYou": "Docelowy użytkownik nie jest z Tobą powiązany!",
"ClientResourcePermissionProviderKeyLookupService": "Klient"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Nome de usuário ou senha inválidos!",
"InvalidAuthenticatorCode": "Código de autenticador inválido!",
"InvalidRecoveryCode": "Código de recuperação inválido!",
"TheTargetUserIsNotLinkedToYou": "O usuário-alvo não está vinculado a você!"
"TheTargetUserIsNotLinkedToYou": "O usuário-alvo não está vinculado a você!",
"ClientResourcePermissionProviderKeyLookupService": "Cliente"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Nume de utilizator sau parolă invalidă!",
"InvalidAuthenticatorCode": "Cod de autentificare invalid!",
"InvalidRecoveryCode": "Cod de recuperare nevalid!",
"TheTargetUserIsNotLinkedToYou": "Utilizatorul ţintă nu este conectat la dumneavoastră!"
"TheTargetUserIsNotLinkedToYou": "Utilizatorul ţintă nu este conectat la dumneavoastră!",
"ClientResourcePermissionProviderKeyLookupService": "Client"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Неверное имя пользователя или пароль!",
"InvalidAuthenticatorCode": "Неверный код аутентификатора!",
"InvalidRecoveryCode": "Неверный код восстановления!",
"TheTargetUserIsNotLinkedToYou": "Целевой пользователь не связан с вами!"
"TheTargetUserIsNotLinkedToYou": "Целевой пользователь не связан с вами!",
"ClientResourcePermissionProviderKeyLookupService": "Клиент"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Nesprávne používateľské meno alebo heslo!",
"InvalidAuthenticatorCode": "Neplatný overovací kód!",
"InvalidRecoveryCode": "Neplatný kód na obnovenie!",
"TheTargetUserIsNotLinkedToYou": "Cieľový používateľ nie je s vami prepojený!"
"TheTargetUserIsNotLinkedToYou": "Cieľový používateľ nie je s vami prepojený!",
"ClientResourcePermissionProviderKeyLookupService": "Klient"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Napačno uporabniško ime ali geslo!",
"InvalidAuthenticatorCode": "Neveljavna koda za preverjanje pristnosti!",
"InvalidRecoveryCode": "Neveljavna obnovitvena koda!",
"TheTargetUserIsNotLinkedToYou": "Ciljni uporabnik ni povezan z vami!"
"TheTargetUserIsNotLinkedToYou": "Ciljni uporabnik ni povezan z vami!",
"ClientResourcePermissionProviderKeyLookupService": "Odjemalec"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Ogiltigt användarnamn eller lösenord!",
"InvalidAuthenticatorCode": "Ogiltig autentiseringskod!",
"InvalidRecoveryCode": "Ogiltig återställningskod!",
"TheTargetUserIsNotLinkedToYou": "Målanvändaren är inte kopplad till dig!"
"TheTargetUserIsNotLinkedToYou": "Målanvändaren är inte kopplad till dig!",
"ClientResourcePermissionProviderKeyLookupService": "Klient"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"InvalidUsername": "Kullanıcı adı ya da şifre geçersiz!",
"InvalidAuthenticatorCode": "Geçersiz kimlik doğrulama kodu!",
"InvalidRecoveryCode": "Geçersiz kurtarma kodu!",
"TheTargetUserIsNotLinkedToYou": "Hedef kullanıcı sizinle bağlantılı değil!"
"TheTargetUserIsNotLinkedToYou": "Hedef kullanıcı sizinle bağlantılı değil!",
"ClientResourcePermissionProviderKeyLookupService": "İstemci"
}
}
Loading
Loading