public virtual async Task TestAddPermissionToPlayer() { IPermissionProvider provider = LoadProvider(); await provider.AddPermissionAsync(TestPlayer, "DynamicGroupPermission"); Assert.AreEqual(PermissionResult.Grant, await provider.CheckPermissionAsync(TestPlayer, "DynamicGroupPermission")); }
public virtual async Task TestAddPermissionToGroup() { IPermissionChecker checker = LoadChecker(); IPermissionProvider provider = LoadProvider(); IPermissionGroup group = await provider.GetGroupAsync("TestGroup2"); await provider.AddPermissionAsync(group, "DynamicGroupPermission"); Assert.AreEqual(PermissionResult.Grant, await checker.CheckPermissionAsync(group, "DynamicGroupPermission")); Assert.AreEqual(PermissionResult.Grant, await checker.CheckPermissionAsync(TestPlayer, "DynamicGroupPermission")); }
protected override async Task UpdatePermissionAsync(IUser user, IPermissionProvider permissions, IPermissionEntity target, string permissionToUpdate) { if (await permissions.AddPermissionAsync(target, permissionToUpdate)) { await user.SendMessageAsync($"Successfully added \"{permissionToUpdate}\" to \"{target.ToString()}\"!", Color.DarkGreen); } else { await user.SendMessageAsync($"Failed to add \"{permissionToUpdate}\" to \"{target.ToString()}\"!", Color.Red); } }