Fix issue saving permissions associated to global roles
This commit is contained in:
parent
88a08c8863
commit
c651dedffd
|
@ -7,6 +7,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
IEnumerable<Role> GetRoles();
|
IEnumerable<Role> GetRoles();
|
||||||
IEnumerable<Role> GetRoles(int SiteId);
|
IEnumerable<Role> GetRoles(int SiteId);
|
||||||
|
IEnumerable<Role> GetRoles(int SiteId, bool IncludeGlobalRoles);
|
||||||
Role AddRole(Role Role);
|
Role AddRole(Role Role);
|
||||||
Role UpdateRole(Role Role);
|
Role UpdateRole(Role Role);
|
||||||
Role GetRole(int RoleId);
|
Role GetRole(int RoleId);
|
||||||
|
|
|
@ -192,7 +192,7 @@ namespace Oqtane.Repository
|
||||||
public List<Permission> DecodePermissions(string PermissionStrings, int SiteId, string EntityName, int EntityId)
|
public List<Permission> DecodePermissions(string PermissionStrings, int SiteId, string EntityName, int EntityId)
|
||||||
{
|
{
|
||||||
List<Permission> permissions = new List<Permission>();
|
List<Permission> permissions = new List<Permission>();
|
||||||
List<Role> roles = Roles.GetRoles(SiteId).ToList();
|
List<Role> roles = Roles.GetRoles(SiteId, true).ToList();
|
||||||
string securityid = "";
|
string securityid = "";
|
||||||
foreach (PermissionString permissionstring in JsonSerializer.Deserialize<List<PermissionString>>(PermissionStrings))
|
foreach (PermissionString permissionstring in JsonSerializer.Deserialize<List<PermissionString>>(PermissionStrings))
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,19 @@ namespace Oqtane.Repository
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Role> GetRoles(int SiteId, bool IncludeGlobalRoles)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return db.Role.Where(item => item.SiteId == SiteId || item.SiteId == null).ToList();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Role AddRole(Role Role)
|
public Role AddRole(Role Role)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace Oqtane.Models
|
||||||
public class Role : IAuditable
|
public class Role : IAuditable
|
||||||
{
|
{
|
||||||
public int RoleId { get; set; }
|
public int RoleId { get; set; }
|
||||||
public int SiteId { get; set; }
|
public int? SiteId { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public bool IsAutoAssigned { get; set; }
|
public bool IsAutoAssigned { get; set; }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user