Major refactoring replacing permission strings with permission collections. These changes will require extensive regression testing. These changes may include breaking changes which will need to be identified and resolved to provide backward compatibility.
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Oqtane.Models
|
||||
@ -68,7 +69,7 @@ namespace Oqtane.Models
|
||||
/// TODO: todoc what would this contain?
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public string Permissions { get; set; }
|
||||
public List<Permission> Permissions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Folder Depth
|
||||
|
@ -42,7 +42,7 @@ namespace Oqtane.Models
|
||||
#endregion
|
||||
|
||||
[NotMapped]
|
||||
public string Permissions { get; set; }
|
||||
public List<Permission> Permissions { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<string, string> Settings { get; set; }
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Oqtane.Documentation;
|
||||
|
||||
@ -99,7 +100,7 @@ namespace Oqtane.Models
|
||||
[NotMapped]
|
||||
public string AssemblyName { get; set; }
|
||||
[NotMapped]
|
||||
public string Permissions { get; set; }
|
||||
public List<Permission> Permissions { get; set; }
|
||||
[NotMapped]
|
||||
public string Template { get; set; }
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ namespace Oqtane.Models
|
||||
public List<Resource> Resources { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string Permissions { get; set; }
|
||||
public List<Permission> Permissions { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<string, string> Settings { get; set; }
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Models
|
||||
{
|
||||
@ -66,15 +67,41 @@ namespace Oqtane.Models
|
||||
|
||||
public Permission(string permissionName, string roleName, bool isAuthorized)
|
||||
{
|
||||
PermissionName = permissionName;
|
||||
Role = new Role { Name = roleName };
|
||||
IsAuthorized = isAuthorized;
|
||||
Initialize("", -1, permissionName, roleName, null, isAuthorized);
|
||||
}
|
||||
|
||||
public Permission(string permissionName, int userId, bool isAuthorized)
|
||||
{
|
||||
Initialize("", -1, permissionName, "", userId, isAuthorized);
|
||||
}
|
||||
|
||||
public Permission(string entityName, string permissionName, string roleName, int? userId, bool isAuthorized)
|
||||
{
|
||||
Initialize(entityName, -1, permissionName, roleName, userId, isAuthorized);
|
||||
}
|
||||
|
||||
public Permission(string entityName, int entityId, string permissionName, string roleName, int? userId, bool isAuthorized)
|
||||
{
|
||||
Initialize(entityName, entityId, permissionName, roleName, userId, isAuthorized);
|
||||
}
|
||||
|
||||
private void Initialize(string entityName, int entityId, string permissionName, string roleName, int? userId, bool isAuthorized)
|
||||
{
|
||||
EntityName = entityName;
|
||||
EntityId = entityId;
|
||||
PermissionName = permissionName;
|
||||
UserId = userId;
|
||||
if (!string.IsNullOrEmpty(roleName))
|
||||
{
|
||||
Role = new Role { Name = roleName };
|
||||
RoleId = null;
|
||||
UserId = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Role = null;
|
||||
RoleId = null;
|
||||
UserId = userId;
|
||||
}
|
||||
IsAuthorized = isAuthorized;
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
namespace Oqtane.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Use this to define a <see cref="PermissionName"/> which addresses a set of multiple permissions.
|
||||
/// </summary>
|
||||
public class PermissionString
|
||||
{
|
||||
/// <summary>
|
||||
/// A term describing the entity
|
||||
/// </summary>
|
||||
public string EntityName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A term describing a set of permissions
|
||||
/// </summary>
|
||||
public string PermissionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The permissions
|
||||
/// </summary>
|
||||
public string Permissions { get; set; }
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ namespace Oqtane.Models
|
||||
public string Icon { get; set; }
|
||||
public bool IsNavigation { get; set; }
|
||||
public bool IsPersonalizable { get; set; }
|
||||
public string PagePermissions { get; set; }
|
||||
public List<Permission> PagePermissions { get; set; }
|
||||
public List<PageTemplateModule> PageTemplateModules { get; set; }
|
||||
|
||||
[Obsolete("This property is obsolete", false)]
|
||||
@ -30,7 +30,7 @@ namespace Oqtane.Models
|
||||
public string ModuleDefinitionName { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Pane { get; set; }
|
||||
public string ModulePermissions { get; set; }
|
||||
public List<Permission> ModulePermissions { get; set; }
|
||||
public string Content { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user