diff --git a/RMuseum/Services/Implementation/RecitationService.cs b/RMuseum/Services/Implementation/RecitationService.cs
index 513dcaee..7419c33e 100644
--- a/RMuseum/Services/Implementation/RecitationService.cs
+++ b/RMuseum/Services/Implementation/RecitationService.cs
@@ -451,7 +451,7 @@ namespace RMuseum.Services.Implementationa
(
(Guid)moderator.Id ,
"درخواست بررسی خوانش",
- $"درخواستی برای بررسی خوانشی از «{narration.AudioArtist}» ثبت شده است. در صورت تمایل صورت تمایل به بررسی بخش «خوانشهای در انتظار تأیید» را ببینید.{ Environment.NewLine}" +
+ $"درخواستی برای بررسی خوانشی از «{narration.AudioArtist}» ثبت شده است. در صورت تمایل به بررسی، بخش «خوانشهای در انتظار تأیید» را ببینید.{ Environment.NewLine}" +
$"توجه فرمایید که اگر کاربر دیگری که دارای مجوز بررسی خوانشهاست پیش از شما به آن رسیدگی کرده باشد آن را در صف نخواهید دید."
);
}
diff --git a/RSecurityBackend/RSecurityBackend.xml b/RSecurityBackend/RSecurityBackend.xml
index 63442503..7f2aaf52 100644
--- a/RSecurityBackend/RSecurityBackend.xml
+++ b/RSecurityBackend/RSecurityBackend.xml
@@ -2055,11 +2055,6 @@
-
-
- Administrator role name
-
-
secret used for generating Jwt token
@@ -2394,11 +2389,6 @@
-
-
- Administrator role name
-
-
secret used for generating Jwt token
@@ -2767,6 +2757,11 @@
User Roles Service Implementation
+
+
+ Administrator role name
+
+
returns all user roles
@@ -2919,6 +2914,11 @@
User Groups Service
+
+
+ Administrator role name
+
+
returns all user roles
diff --git a/RSecurityBackend/Services/IAppUserService.cs b/RSecurityBackend/Services/IAppUserService.cs
index ce431f30..b7a951d6 100644
--- a/RSecurityBackend/Services/IAppUserService.cs
+++ b/RSecurityBackend/Services/IAppUserService.cs
@@ -255,10 +255,7 @@ namespace RSecurityBackend.Services
Task> FindUserByEmail(string email);
- ///
- /// Administrator role name
- ///
- string AdministratorRoleName { get; }
+
///
/// secret used for generating Jwt token
diff --git a/RSecurityBackend/Services/IUserRoleService.cs b/RSecurityBackend/Services/IUserRoleService.cs
index 13de7a00..db8c3366 100644
--- a/RSecurityBackend/Services/IUserRoleService.cs
+++ b/RSecurityBackend/Services/IUserRoleService.cs
@@ -11,6 +11,11 @@ namespace RSecurityBackend.Services
///
public interface IUserRoleService
{
+ ///
+ /// Administrator role name
+ ///
+ string AdministratorRoleName { get; }
+
///
/// returns all user roles
///
diff --git a/RSecurityBackend/Services/Implementation/AppUserService.cs b/RSecurityBackend/Services/Implementation/AppUserService.cs
index 559c2f9f..1628bf37 100644
--- a/RSecurityBackend/Services/Implementation/AppUserService.cs
+++ b/RSecurityBackend/Services/Implementation/AppUserService.cs
@@ -387,7 +387,7 @@ namespace RSecurityBackend.Services.Implementation
return new RServiceResult(false, "کاربر مورد نظر یافت نشد");
}
- bool res = await _userManager.IsInRoleAsync(dbUserInfo, AdministratorRoleName);
+ bool res = await _userManager.IsInRoleAsync(dbUserInfo, _userRoleService.AdministratorRoleName);
return new RServiceResult(res);
}
catch(Exception exp)
@@ -689,9 +689,9 @@ namespace RSecurityBackend.Services.Implementation
if(newUserInfo.IsAdmin)
{
- if (!await _roleManager.RoleExistsAsync(AdministratorRoleName))
+ if (!await _roleManager.RoleExistsAsync(_userRoleService.AdministratorRoleName))
{
- var roleCheckResult = await _roleManager.CreateAsync(new RAppRole(AdministratorRoleName));
+ var roleCheckResult = await _roleManager.CreateAsync(new RAppRole(_userRoleService.AdministratorRoleName));
if (!roleCheckResult.Succeeded)
{
return new RServiceResult(null, "Error creating Administrator role : " + ErrorsToString(roleCheckResult.Errors));
@@ -699,7 +699,7 @@ namespace RSecurityBackend.Services.Implementation
}
- var addToAdminRoleResult = await _userManager.AddToRoleAsync(newDbUser, AdministratorRoleName);
+ var addToAdminRoleResult = await _userManager.AddToRoleAsync(newDbUser, _userRoleService.AdministratorRoleName);
if (!addToAdminRoleResult.Succeeded)
{
return new RServiceResult(null, $"Error adding {newDbUser.UserName} to Administrator role : " + ErrorsToString(addToAdminRoleResult.Errors));
@@ -740,7 +740,7 @@ namespace RSecurityBackend.Services.Implementation
if(isAdmin.Result && !updateUserInfo.IsAdmin)
{
- List adminUsers = new List(await _userManager.GetUsersInRoleAsync(AdministratorRoleName));
+ List adminUsers = new List(await _userManager.GetUsersInRoleAsync(_userRoleService.AdministratorRoleName));
int nActiveAdminUsers = 0;
foreach(RAppUser adminUser in adminUsers)
{
@@ -1355,16 +1355,16 @@ namespace RSecurityBackend.Services.Implementation
return new RServiceResult(false, "Error creating default user : " + ErrorsToString(identityResult.Errors));
}
- if (!await _roleManager.RoleExistsAsync(AdministratorRoleName))
+ if (!await _roleManager.RoleExistsAsync(_userRoleService.AdministratorRoleName))
{
- identityResult = await _roleManager.CreateAsync(new RAppRole(AdministratorRoleName));
+ identityResult = await _roleManager.CreateAsync(new RAppRole(_userRoleService.AdministratorRoleName));
if (!identityResult.Succeeded)
{
return new RServiceResult(false, "Error creating Administrator role : " + ErrorsToString(identityResult.Errors));
}
}
- identityResult = await _userManager.AddToRoleAsync(admin, AdministratorRoleName);
+ identityResult = await _userManager.AddToRoleAsync(admin, _userRoleService.AdministratorRoleName);
if (!identityResult.Succeeded)
{
return new RServiceResult(false, "Error adding admin to Administrator role : " + ErrorsToString(identityResult.Errors));
@@ -1379,10 +1379,7 @@ namespace RSecurityBackend.Services.Implementation
}
- ///
- /// Administrator role name
- ///
- public string AdministratorRoleName { get { return "Administrator"; } }
+
///
diff --git a/RSecurityBackend/Services/Implementation/RoleServiceBase.cs b/RSecurityBackend/Services/Implementation/RoleServiceBase.cs
index 42ea77aa..f349817c 100644
--- a/RSecurityBackend/Services/Implementation/RoleServiceBase.cs
+++ b/RSecurityBackend/Services/Implementation/RoleServiceBase.cs
@@ -16,6 +16,11 @@ namespace RSecurityBackend.Services.Implementation
///
public class RoleServiceBase : IUserRoleService
{
+ ///
+ /// Administrator role name
+ ///
+ public string AdministratorRoleName { get { return "Administrator"; } }
+
///
/// returns all user roles
///
@@ -197,7 +202,7 @@ namespace RSecurityBackend.Services.Implementation
{
RAppRole[] rolesInfo = await _roleManager.Roles
.Include(r => r.Permissions)
- .Where(r => r.Permissions.Any(p => p.SecurableItemShortName == securableItemShortName && p.OperationShortName == operationShortName) )
+ .Where(r => r.Name == AdministratorRoleName || r.Permissions.Any(p => p.SecurableItemShortName == securableItemShortName && p.OperationShortName == operationShortName) )
.ToArrayAsync();
return new RServiceResult(rolesInfo);
}