summaryrefslogtreecommitdiff
path: root/Project-Unite/Models
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-17 09:52:57 -0400
committerMichael <[email protected]>2017-05-17 09:52:57 -0400
commit7e54c9b3fad48c7bce1134f7937924f120f1999c (patch)
treef922e35184e7e9f0cc90d0dc11f4541a414d35bd /Project-Unite/Models
parent1abd027bdbd55fac59ad5bcdd8df301bb2499204 (diff)
downloadproject-unite-7e54c9b3fad48c7bce1134f7937924f120f1999c.tar.gz
project-unite-7e54c9b3fad48c7bce1134f7937924f120f1999c.tar.bz2
project-unite-7e54c9b3fad48c7bce1134f7937924f120f1999c.zip
More fixes, specifically with forum
Diffstat (limited to 'Project-Unite/Models')
-rw-r--r--Project-Unite/Models/AdminViewModels.cs21
-rw-r--r--Project-Unite/Models/ForumCategory.cs50
-rw-r--r--Project-Unite/Models/IdentityModels.cs1
3 files changed, 29 insertions, 43 deletions
diff --git a/Project-Unite/Models/AdminViewModels.cs b/Project-Unite/Models/AdminViewModels.cs
index 23935d3..a03775e 100644
--- a/Project-Unite/Models/AdminViewModels.cs
+++ b/Project-Unite/Models/AdminViewModels.cs
@@ -7,27 +7,6 @@ using System.Web.Mvc;
namespace Project_Unite.Models
{
- public class AdminAccessControlViewModel
- {
- public AdminAccessControlViewModel()
- {
-
- }
-
- public AdminAccessControlViewModel(Dictionary<string, ForumPermission[]> modelList)
- {
- ACLList = new List<ForumPermission>();
- foreach(var v in modelList.Values)
- {
- ACLList.AddRange(v);
- }
- IDs = modelList.Keys.ToList();
- }
-
- public List<string> IDs { get; set; }
- public List<ForumPermission> ACLList { get; set; }
- }
-
public class CreateUserModel
{
diff --git a/Project-Unite/Models/ForumCategory.cs b/Project-Unite/Models/ForumCategory.cs
index da5a9c9..52e184e 100644
--- a/Project-Unite/Models/ForumCategory.cs
+++ b/Project-Unite/Models/ForumCategory.cs
@@ -39,28 +39,12 @@ namespace Project_Unite.Models
public virtual string Parent { get; set; }
- public ForumPermission[] Permissions { get
- {
- var db = new ApplicationDbContext();
- return db.ForumPermissions.Where(x => x.CategoryId == this.Id).ToArray();
- }
- }
- }
-
- public class ForumPermission
- {
- [Key]
- public string Id { get; set; }
-
- [Required]
- public string CategoryId { get; set; }
-
- [Required]
- public string RoleId { get; set; }
+ public int AdminPermission { get; set; }
+ public int DeveloperPermission { get; set; }
+ public int ModeratorPermission { get; set; }
+ public int MemberPermission { get; set; }
- [Required]
- [EnumDataType(typeof(PermissionPreset))]
- public PermissionPreset Permissions { get; set; }
+ public bool VisibleToGuests { get; set; }
}
public class ForumPost
@@ -124,8 +108,32 @@ namespace Project_Unite.Models
public bool IsLocked { get; set; }
+ public int Priority
+ {
+ get
+ {
+ int priority = 0;
+ if (IsSticky)
+ priority = 1;
+ if (IsAnnounce)
+ priority = 2;
+ if (IsSticky && IsAnnounce)
+ priority = 3;
+ return priority;
+ }
+ }
+
public DateTime StartedAt { get; set; }
public string Subject { get; set; }
+ public bool ShouldShow
+ {
+ get
+ {
+ if (IsUnlisted == true)
+ return HttpContext.Current.User?.Identity?.IsModerator() == true;
+ return true;
+ }
+ }
public string AuthorId { get; set; }
public bool IsSticky { get; set; }
public bool IsAnnounce { get; set; }
diff --git a/Project-Unite/Models/IdentityModels.cs b/Project-Unite/Models/IdentityModels.cs
index 46c8e56..a16dfe7 100644
--- a/Project-Unite/Models/IdentityModels.cs
+++ b/Project-Unite/Models/IdentityModels.cs
@@ -241,7 +241,6 @@ namespace Project_Unite.Models
public DbSet<UserPost> UserPosts { get; set; }
public DbSet<ForumPostEdit> ForumPostEdits { get; set; }
public DbSet<Like> Likes { get; set; }
- public DbSet<ForumPermission> ForumPermissions { get; set; }
public DbSet<BannedIP> BannedIPs { get; set; }
public DbSet<AuditLog> AuditLogs { get; set; }
public System.Data.Entity.DbSet<Project_Unite.Models.Role> IdentityRoles { get; set; }