From 4ad8309c444ed838aeec8b19a3671a5348f751ad Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Fri, 8 Feb 2019 19:04:36 +0300 Subject: [PATCH] Authorize IdentityUserLookupAppService --- .../Abp/Identity/IdentityPermissionDefinitionProvider.cs | 2 ++ .../Volo/Abp/Identity/IdentityPermissions.cs | 5 +++++ .../Abp/Identity/Localization/ApplicationContracts/en.json | 3 ++- .../Abp/Identity/Localization/ApplicationContracts/tr.json | 3 ++- .../Volo/Abp/Identity/IdentityUserLookupAppService.cs | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissionDefinitionProvider.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissionDefinitionProvider.cs index 5315b9248c..1c8a8df8d0 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissionDefinitionProvider.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissionDefinitionProvider.cs @@ -21,6 +21,8 @@ namespace Volo.Abp.Identity usersPermission.AddChild(IdentityPermissions.Users.Update, L("Permission:Edit")); usersPermission.AddChild(IdentityPermissions.Users.Delete, L("Permission:Delete")); usersPermission.AddChild(IdentityPermissions.Users.ManagePermissions, L("Permission:ChangePermissions")); + + identityGroup.AddPermission(IdentityPermissions.UserLookup.Default, L("Permission:UserLookup")); } private static LocalizableString L(string name) diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissions.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissions.cs index 3004cc81df..ffe69f2362 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissions.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissions.cs @@ -22,6 +22,11 @@ public const string ManagePermissions = Default + ".ManagePermissions"; } + public static class UserLookup + { + public const string Default = GroupName + ".UserLookup"; + } + public static string[] GetAll() { return new[] diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/en.json b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/en.json index 5b1f6305c3..4a302c8057 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/en.json +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/en.json @@ -7,6 +7,7 @@ "Permission:Edit": "Edit", "Permission:Delete": "Delete", "Permission:ChangePermissions": "Change permissions", - "Permission:UserManagement": "User management" + "Permission:UserManagement": "User management", + "Permission:UserLookup": "User lookup" } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/tr.json b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/tr.json index c185fc1b9e..25760c354b 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/tr.json +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/tr.json @@ -7,6 +7,7 @@ "Permission:Edit": "Düzenleme", "Permission:Delete": "Silme", "Permission:ChangePermissions": "İzinleri değiştirme", - "Permission:UserManagement": "Kullanıcı yönetimi" + "Permission:UserManagement": "Kullanıcı yönetimi", + "Permission:UserLookup": "Kullanıcı sorgulama" } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs index 4e788359c7..48d42c4579 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs @@ -5,7 +5,7 @@ using Volo.Abp.Users; namespace Volo.Abp.Identity { - //TODO: Authorization (for clients, not users) + [Authorize(IdentityPermissions.UserLookup.Default)] public class IdentityUserLookupAppService : IdentityAppServiceBase, IIdentityUserLookupAppService { protected IdentityUserRepositoryExternalUserLookupServiceProvider UserLookupServiceProvider { get; }