user and role management improvements

This commit is contained in:
Shaun Walker
2021-04-24 13:47:20 -04:00
parent 5a519510a9
commit d42c7a5ea5
6 changed files with 35 additions and 21 deletions

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Oqtane.Models;
@ -16,12 +16,19 @@ namespace Oqtane.Repository
public IEnumerable<Role> GetRoles(int siteId)
{
return _db.Role.Where(item => item.SiteId == siteId);
return GetRoles(siteId, false);
}
public IEnumerable<Role> GetRoles(int siteId, bool includeGlobalRoles)
{
return _db.Role.Where(item => item.SiteId == siteId || item.SiteId == null);
if (includeGlobalRoles)
{
return _db.Role.Where(item => item.SiteId == siteId || item.SiteId == null);
}
else
{
return _db.Role.Where(item => item.SiteId == siteId);
}
}
public Role AddRole(Role role)