v1.2.0
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.1.8.0";
|
||||
private static String version { get; } = "1.2.0.0";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -40,8 +40,11 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.2.0 1-Nov-2021 'Admin' Organisation role
|
||||
// - 'Admin' Organisation role
|
||||
// - Azure App Service configuration.
|
||||
// 1.1.8 21-Oct-2021 Online Users Search
|
||||
// - ONlien Search - Users.
|
||||
// - Online Search - Users.
|
||||
// - Admin Account Users filter.
|
||||
// 1.1.7 14-Oct-2021 Online Organisation Search
|
||||
// - Online Profile Sport About & snags.
|
||||
|
||||
@@ -232,6 +232,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
Unknown = 0,
|
||||
/* Do not change the values/codes - tied to database. */
|
||||
Member,
|
||||
Admin,
|
||||
MemberAdmin,
|
||||
ScheduleAdmin,
|
||||
OpportunityAdmin,
|
||||
|
||||
@@ -144,10 +144,11 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//---------------------------------------------------------------
|
||||
// Organisation roles.
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.Member, "MBR", "Member");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.MemberAdmin, "MBA", "Member Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.ScheduleAdmin, "SCA", "Schedule Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.OpportunityAdmin, "OPA", "Opportunity Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.ArticleAdmin, "ARA", "Article Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.Admin, "ADM", "Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.MemberAdmin, "MBA", "Members");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.ScheduleAdmin, "SCA", "Schedule");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.OpportunityAdmin, "OPA", "Opportunities");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.ArticleAdmin, "ARA", "Articles");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Opportunity types.
|
||||
|
||||
@@ -101,9 +101,9 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
if (!Changed) Changed = !data.OrganisationRoles.IsEmpty();
|
||||
data.OrganisationRoles.Clear();
|
||||
}
|
||||
public bool HasOrganisationRole(Sax.OrganisationRole organisationRole)
|
||||
public bool HasAnyOrganisationRole(IEnumerable<Sax.OrganisationRole> organisationRoles)
|
||||
{
|
||||
return data.OrganisationRoles.Contains(organisationRole);
|
||||
return data.OrganisationRoles.Any(item => organisationRoles.Contains(item));
|
||||
}
|
||||
public void AddOrganisationRole(Sax.OrganisationRole organisationRole)
|
||||
{
|
||||
@@ -114,7 +114,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
}
|
||||
}
|
||||
/// <summary>Store organisation roles.</summary>
|
||||
public List<Sax.OrganisationRole> OrganisationRoles
|
||||
public IEnumerable<Sax.OrganisationRole> OrganisationRoles
|
||||
{
|
||||
set
|
||||
{
|
||||
@@ -240,6 +240,16 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
return GetOrganisationRoleCodes().Concat(UserOrgnisationRoleDelim);
|
||||
}
|
||||
// Query roles.
|
||||
public bool CanManageOrganisation{ get { return HasAnyOrganisationRole(new [] { Sax.OrganisationRole.Admin }); } }
|
||||
public bool CanManageMembers { get { return HasAnyOrganisationRole(new [] { Sax.OrganisationRole.Admin, Sax.OrganisationRole.MemberAdmin }); } }
|
||||
public bool CanManageOpportunities { get { return HasAnyOrganisationRole(new [] { Sax.OrganisationRole.Admin, Sax.OrganisationRole.OpportunityAdmin }); } }
|
||||
public bool CanManageSchedule { get { return HasAnyOrganisationRole(new [] { Sax.OrganisationRole.Admin, Sax.OrganisationRole.ScheduleAdmin }); } }
|
||||
public bool CanManageArticles { get { return HasAnyOrganisationRole(new [] { Sax.OrganisationRole.Admin, Sax.OrganisationRole.ArticleAdmin }); } }
|
||||
public bool HasAnyOrganisationRole(IEnumerable<Sax.OrganisationRole> organisationRoles)
|
||||
{
|
||||
return data.HasAnyOrganisationRole(organisationRoles);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
@@ -290,7 +300,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
return data.GetOrganisationRoles();
|
||||
}
|
||||
/// <summary>Store Organisation Roles.</summary>
|
||||
public List<Sax.OrganisationRole> OrganisationRoles
|
||||
public IEnumerable<Sax.OrganisationRole> OrganisationRoles
|
||||
{
|
||||
set { data.OrganisationRoles = value; }
|
||||
}
|
||||
@@ -298,10 +308,6 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
data.ClearOrganisationRoles();
|
||||
}
|
||||
public bool HasOrganisationRole(Sax.OrganisationRole organisationRole)
|
||||
{
|
||||
return data.HasOrganisationRole(organisationRole);
|
||||
}
|
||||
public void AddOrganisationRole(Sax.OrganisationRole organisationRole)
|
||||
{
|
||||
data.AddOrganisationRole(organisationRole);
|
||||
@@ -347,6 +353,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
/// <summary>Set true to restruct to User Organisations with at least one Organisation Role.</summary>
|
||||
public bool OrganisationMembersOnly { get; set; }
|
||||
public List<Sax.OrganisationRole> OrganisationRoles { get; } = new List<Sax.OrganisationRole>();
|
||||
public List<Sax.OrganisationRole> OrganisationRolesAny { get; } = new List<Sax.OrganisationRole>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
|
||||
@@ -39,8 +39,16 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
/// </summary>
|
||||
public bool UserHasOrganisationRole(SysId userAccountId, SysId organisationId, Sax.OrganisationRole organisationRole, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||
{
|
||||
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(organisationId) || organisationRole <= 0) return false;
|
||||
return GetOrganisationRolesForUser(userAccountId, organisationId, statusCat).Contains(organisationRole);
|
||||
return UserHasAnyOrganisationRole(userAccountId, organisationId, new [] { organisationRole }, statusCat);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does the user have any of the specified roles with the organisation.
|
||||
/// </summary>
|
||||
public bool UserHasAnyOrganisationRole(SysId userAccountId, SysId organisationId, IEnumerable<Sax.OrganisationRole> organisationRoles, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||
{
|
||||
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(organisationId) || organisationRoles.IsEmpty() || !organisationRoles.Any(item => item > 0)) return false;
|
||||
return GetOrganisationRolesForUser(userAccountId, organisationId, statusCat).Any(item => organisationRoles.Contains(item));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,24 +75,40 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list of organisation Ids that the user has the specified role with.
|
||||
/// Get list of organisation Ids and names that the user has the specified role with.
|
||||
/// </summary>
|
||||
public List<OrganisationIdName> GetOrganisationsForUserRole(SysId userAccountId, Sax.OrganisationRole organisationRole, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||
{
|
||||
List<OrganisationIdName> organisationsData = new List<OrganisationIdName>();
|
||||
String organisationRoleCode = Internals.OrganisationRoleCodes.GetCodeForType(organisationRole);
|
||||
if (!SysId.IsValid(userAccountId) || StringUtil.IsEmpty(organisationRoleCode)) return organisationsData;
|
||||
// Columns.
|
||||
ColumnDfn colOrganisationId = GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
|
||||
ColumnDfn colOrganisationName = GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
|
||||
return GetOrganisationsForAnyUserRole(userAccountId, new [] { organisationRole }, statusCat);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list of organisation Ids and names that the user has any of the specified roles with.
|
||||
/// </summary>
|
||||
public List<OrganisationIdName> GetOrganisationsForAnyUserRole(SysId userAccountId, IEnumerable<Sax.OrganisationRole> organisationRoles, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||
{
|
||||
if (!SysId.IsValid(userAccountId) || organisationRoles.IsEmpty() || !organisationRoles.Any(item => item > 0)) return null;
|
||||
// Filter.
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(userAccountId);
|
||||
prmUserOrganisation.OrganisationStatusCat = SaxOrganisation.StatusCat.ActiveOnly;
|
||||
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||
prmUserOrganisation.OrganisationRoles.Add(organisationRole);
|
||||
prmUserOrganisation.OrganisationRolesAny.AddRange(organisationRoles);
|
||||
prmUserOrganisation.StatusCat = statusCat;
|
||||
prmUserOrganisation.SortColumns.Add(colOrganisationName);
|
||||
return GetOrganisations(prmUserOrganisation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list of organisation Ids and names that matc the specified parameters.
|
||||
/// </summary>
|
||||
public List<OrganisationIdName> GetOrganisations(SaxUserOrganisation.Params prmUserOrganisation)
|
||||
{
|
||||
List<OrganisationIdName> organisationsData = new List<OrganisationIdName>();
|
||||
// Columns.
|
||||
ColumnDfn colOrganisationId = GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
|
||||
ColumnDfn colOrganisationName = GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
|
||||
if (prmUserOrganisation.SortColumns.IsEmpty())
|
||||
prmUserOrganisation.SortColumns.Add(colOrganisationName);
|
||||
// Query.
|
||||
using (DbResultSet resultSet = ExecuteUserOrganisationQuery(new List<ColumnDfn>() { colOrganisationId, colOrganisationName }, prmUserOrganisation))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user