* Fixed webapi auth
* WIP signalauth * Fist commit server config
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Step.Model;
|
||||
using static Step.Config.Constants;
|
||||
|
||||
namespace Step.Database.Controllers
|
||||
{
|
||||
public class AccessCategoriesController : IDisposable
|
||||
{
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
public AccessCategoriesController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
public int FindCategoryLevelByAction(string categoryName, ACTIONS action)
|
||||
{
|
||||
AccessCategoryModel accessCategories = dbCtx.AccessCategories.Where(ac => ac.Name == categoryName).FirstOrDefault();
|
||||
if (accessCategories != null)
|
||||
{
|
||||
if (ACTIONS.READ == action)
|
||||
return accessCategories.ReadLevelMin;
|
||||
else
|
||||
return accessCategories.WriteLevelMin;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user