mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 23:42:36 -07:00
A lot of clean up and added a new Image api #865
This commit is contained in:
parent
69d75976c5
commit
1eb18b3187
32 changed files with 454 additions and 61 deletions
|
@ -27,22 +27,19 @@ namespace Ombi.Core.Engine.Interfaces
|
|||
protected string Username => UserPrinciple.Identity.Name;
|
||||
|
||||
private OmbiUser _user;
|
||||
protected async Task<OmbiUser> User()
|
||||
protected async Task<OmbiUser> GetUser()
|
||||
{
|
||||
if(_user == null)
|
||||
_user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName == Username);
|
||||
|
||||
return _user;
|
||||
return _user ?? (_user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName == Username));
|
||||
}
|
||||
|
||||
protected async Task<string> UserAlias()
|
||||
{
|
||||
return (await User()).UserAlias;
|
||||
return (await GetUser()).UserAlias;
|
||||
}
|
||||
|
||||
protected async Task<bool> IsInRole(string roleName)
|
||||
{
|
||||
return await UserManager.IsInRoleAsync(await User(), roleName);
|
||||
return await UserManager.IsInRoleAsync(await GetUser(), roleName);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<RuleResult>> RunRequestRules(BaseRequest model)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue