forked from ddrilling/AsbCloudServer
nit remove unused methods
This commit is contained in:
parent
87e594f5c0
commit
ab278f6a2f
@ -15,7 +15,7 @@ namespace AsbCloudApp.Data.SAUB
|
||||
/// <summary>
|
||||
/// метка времени данных (legacy)
|
||||
/// </summary>
|
||||
public DateTime Date // TODO: remove this legacy after all panels updated
|
||||
public DateTime Date // TODO: remove this legacy after all panels updated (> 3.2.0407)
|
||||
{
|
||||
get { return DateTime; }
|
||||
set { DateTime = value; }
|
||||
|
@ -10,15 +10,6 @@ namespace AsbCloudApp.Services
|
||||
/// </summary>
|
||||
public interface IUserRoleService : ICrudService<UserRoleDto>
|
||||
{
|
||||
// todo: скорее всего не используется
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserRoleDto> GetByNameAsync(string name, CancellationToken token = default);
|
||||
|
||||
// todo: переименовать
|
||||
/// <summary>
|
||||
/// получить dto по названиям
|
||||
|
@ -28,24 +28,6 @@ namespace AsbCloudApp.Services
|
||||
/// <returns></returns>
|
||||
IEnumerable<UserRoleDto> GetRolesByIdUser(int idUser, int nestedLevel = 0);
|
||||
|
||||
// TODO: скорее всего не используется
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="idUser"></param>
|
||||
/// <param name="roleNames"></param>
|
||||
/// <returns></returns>
|
||||
bool HasAnyRoleOf(int idUser, IEnumerable<string> roleNames);
|
||||
|
||||
// TODO: скорее всего не используется
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="idUser"></param>
|
||||
/// <param name="roleIds"></param>
|
||||
/// <returns></returns>
|
||||
bool HasAnyRoleOf(int idUser, IEnumerable<int> roleIds);
|
||||
|
||||
/// <summary>
|
||||
/// определяет есть ли у пользователя указанное разрешение
|
||||
/// </summary>
|
||||
|
@ -49,9 +49,8 @@ namespace AsbCloudApp.Services
|
||||
/// <returns></returns>
|
||||
Task<string> GetWellCaptionByIdAsync(int idWell, CancellationToken token);
|
||||
|
||||
//TODO: remove that
|
||||
/// <summary>
|
||||
///
|
||||
/// список компаний участвующих в скважине
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="token"></param>
|
||||
|
@ -75,16 +75,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
return dto;
|
||||
}
|
||||
|
||||
public async Task<UserRoleDto> GetByNameAsync(string name, CancellationToken token = default)
|
||||
{
|
||||
var entity = await cacheUserRoles.FirstOrDefaultAsync(r => r.Caption == name, token)
|
||||
.ConfigureAwait(false);
|
||||
if (entity is null)
|
||||
return null;
|
||||
var dto = Convert(entity);
|
||||
return dto;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<UserRoleDto>> GetByNamesAsync(IEnumerable<string> names, CancellationToken token = default)
|
||||
{
|
||||
if (names?.Any() != true)
|
||||
|
@ -167,28 +167,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
}), token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public bool HasAnyRoleOf(int idUser, IEnumerable<string> roleNames)
|
||||
{
|
||||
if (!roleNames.Any())
|
||||
return true;
|
||||
var userRoleNames = GetRolesNamesByIdUser(idUser);
|
||||
foreach (var roleName in userRoleNames)
|
||||
if (roleNames.Contains(roleName))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasAnyRoleOf(int idUser, IEnumerable<int> roleIds)
|
||||
{
|
||||
if (!roleIds.Any())
|
||||
return true;
|
||||
var userRoles = GetRolesByIdUser(idUser);
|
||||
foreach (var role in userRoles)
|
||||
if (roleIds.Contains(role.Id))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasPermission(int idUser, string permissionName)
|
||||
{
|
||||
if (idUser == 1)
|
||||
|
Loading…
Reference in New Issue
Block a user