Esempio n. 1
0
        public virtual async Task TestAddPermissionToPlayer()
        {
            IPermissionProvider provider = LoadProvider();
            await provider.AddPermissionAsync(TestPlayer, "DynamicGroupPermission");

            Assert.AreEqual(PermissionResult.Grant, await provider.CheckPermissionAsync(TestPlayer, "DynamicGroupPermission"));
        }
Esempio n. 2
0
        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"));
        }
Esempio n. 3
0
 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);
     }
 }