forked from Sarah/Lieb-Website
Raids and RaidTemplates are now only editable by their owner or moderators
reworked user rights
This commit is contained in:
parent
cb683723b7
commit
2bf630f3a1
25 changed files with 258 additions and 270 deletions
|
@ -70,7 +70,7 @@
|
|||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
|
||||
ulong discordId = ulong.Parse(authState.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value);
|
||||
_user = UserService.GetLiebUserSmall(discordId);
|
||||
_user = UserService.GetLiebUserGW2AccountOnly(discordId);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
{
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
ulong discordId = ulong.Parse(authState.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value);
|
||||
_user = UserService.GetLiebUserSmall(discordId);
|
||||
_user = UserService.GetLiebUserGW2AccountOnly(discordId);
|
||||
|
||||
if(!string.IsNullOrEmpty(gw2Id) && int.TryParse(gw2Id, out int parsedId) && _user.GuildWars2Accounts.Where(a => a.GuildWars2AccountId == parsedId).Any())
|
||||
{
|
||||
|
|
|
@ -8,20 +8,19 @@
|
|||
<h3>Role Edit</h3>
|
||||
|
||||
|
||||
<AuthorizeView Policy="@Constants.Roles.Admin">
|
||||
<AuthorizeView Policy="@Constants.Roles.Admin.Name">
|
||||
<Authorized>
|
||||
|
||||
<table>
|
||||
@foreach(LiebRole role in _roles)
|
||||
{
|
||||
<tr>
|
||||
<td>@if(!role.IsSystemRole)
|
||||
{
|
||||
<button type=button @onclick="() => DeleteRoleClicked(role)">Delete Role</button>
|
||||
}</td>
|
||||
<td>@role.RoleName</td>
|
||||
</tr>
|
||||
}
|
||||
<table>
|
||||
@foreach(LiebRole role in _roles)
|
||||
{
|
||||
<tr>
|
||||
<td>@role.RoleName</td>
|
||||
<td>@if(role.Type == RoleType.UserDefinedRole)
|
||||
{
|
||||
<button type=button @onclick="() => DeleteRoleClicked(role)">Delete Role</button>
|
||||
}</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
<p>
|
||||
<label>
|
||||
|
@ -50,9 +49,9 @@
|
|||
LiebRole role = new LiebRole()
|
||||
{
|
||||
RoleName = _newRoleName,
|
||||
IsSystemRole = false,
|
||||
Type = RoleType.UserDefinedRole,
|
||||
Level = 0,
|
||||
LevelToAssign = Constants.RoleLevels.RaidLeadLevel
|
||||
LevelToAssign = Constants.Roles.RaidLead.PowerLevel
|
||||
};
|
||||
await UserService.AddRole(role);
|
||||
_roles = UserService.GetLiebRoles();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<ValidationSummary />
|
||||
|
||||
|
||||
<AuthorizeView Policy="@Constants.Roles.Admin" Context="authorizationContext">
|
||||
<AuthorizeView Policy="@Constants.Roles.Admin.Name" Context="authorizationContext">
|
||||
<Authorized>
|
||||
<p>@_submitMessage</p>
|
||||
<p>
|
||||
|
@ -44,21 +44,18 @@
|
|||
<tr>
|
||||
<th></th>
|
||||
<th>Role</th>
|
||||
<th>IsSystemRole</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
@foreach (LiebRole role in _roles)
|
||||
{
|
||||
<tr>
|
||||
@{
|
||||
bool hasRole = _user.RoleAssignments.Where(a => a.LiebRoleId == role.LiebRoleId).Any();
|
||||
bool disabled = _editingUserRights < role.LevelToAssign;
|
||||
bool disabled = _editingUserRights < role.LevelToAssign || role.Type == RoleType.GuildRole;
|
||||
}
|
||||
<td><input type="checkbox" disabled="@disabled" checked="@hasRole" @onchange="args => RoleStatusChanged(role, args)" /></td>
|
||||
<td>@role.RoleName</td>
|
||||
@if(@role.IsSystemRole)
|
||||
{
|
||||
<td>True</td>
|
||||
}
|
||||
<td>@role.Type.ToString()</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<h3>UserOverview</h3>
|
||||
|
||||
|
||||
<AuthorizeView Policy="@Constants.Roles.Admin">
|
||||
<AuthorizeView Policy="@Constants.Roles.Admin.Name">
|
||||
<Authorized>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="roleedit">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue