SignupAuthentication canAddOthers for admin
This commit is contained in:
parent
048ccd7c4c
commit
d48186d4d6
@ -10,5 +10,6 @@ namespace API.Authentication.GrantNames
|
||||
public const string CanUpdate = "api.signup.update";
|
||||
public const string CanDeleteAny = "api.signup.delete.any";
|
||||
public const string CanDelete = "api.signup.delete";
|
||||
public const string CanAddOthers = "api.signup.add.others";
|
||||
}
|
||||
}
|
||||
|
@ -10,15 +10,15 @@ namespace API.Authentication
|
||||
{
|
||||
private readonly IGrantManager _grantManager;
|
||||
private readonly ILogger<SignupAuthentication> _logger;
|
||||
|
||||
|
||||
public SignupAuthentication(IGrantManager grantManager, ILogger<SignupAuthentication> logger)
|
||||
{
|
||||
_grantManager = grantManager;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
||||
//todo make more restrictive
|
||||
|
||||
|
||||
public bool canGetAll(User user)
|
||||
{
|
||||
return _grantManager.hasGrant(user.permissionId, SignupGrantNames.CanGetAll);
|
||||
@ -30,7 +30,9 @@ namespace API.Authentication
|
||||
}
|
||||
public bool canAdd(SignupDTO item, User user)
|
||||
{
|
||||
return _grantManager.hasGrant(user.permissionId, SignupGrantNames.CanAdd);
|
||||
if (item.userId == user.id)
|
||||
return _grantManager.hasGrant(user.permissionId, SignupGrantNames.CanAdd);
|
||||
return _grantManager.hasGrant(user.permissionId, SignupGrantNames.CanAddOthers);
|
||||
}
|
||||
public bool canUpdate(Signup model, User user)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user