Beispiel #1
0
        private void save()
        {
            var grants = PrivilegeList.Where(p => p.IsGrant).Select(p => p.ActionType).ToDictionary(p => (int)p, p => true);
            var denies = PrivilegeList.Where(p => !p.IsGrant).Select(p => p.ActionType).ToDictionary(p => (int)p, p => false);

            foreach (int k in denies.Keys)
            {
                if (!grants.Keys.Contains(k))
                {
                    grants.Add(k, denies[k]);
                }
            }
            if (!IsGroup)
            {
                userService.UpdateUserAccess((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        OnRequestClose();
                    }
                }), Party.PartyName, grants);
            }
            //appController.Publish(new UpdatePartyCustomActionsArgs(grants,Party.PartyName));
            //OnRequestClose();
        }
Beispiel #2
0
        private void setPartyCustomActions(bool isgroup, string groupId)
        {
            userService.GetAllUserActionTypes((res, exp) => appController.BeginInvokeOnDispatcher(() =>
            {
                HideBusyIndicator();
                if (exp == null)
                {
                    res.ForEach(c =>
                    {
                        UserActions.Add((int)c, true);
                    });


                    PrivilegeList.Where(all => UserActions.Where(c => c.Value).Select(c => c.Key).Contains((int)all.ActionType))
                    .ToList().ForEach(p => p.IsGrant = true);

                    PrivilegeList.Where(all => UserActions.Where(c => !c.Value).Select(c => c.Key).Contains((int)all.ActionType))
                    .ToList().ForEach(p => p.IsGrant = false);
                }
                else
                {
                    appController.HandleException(exp);
                }
            }), Party.PartyName, isgroup, groupId);

            //PrivilegeList.Where(all => Party.CustomActions.Where(c => c.Value).Select(c => c.Key).Contains(all.ActionType.Id))
            //     .ToList().ForEach(p => p.IsGrant = true);

            // PrivilegeList.Where(all => Party.CustomActions.Where(c => !c.Value).Select(c => c.Key).Contains(all.ActionType.Id))
            //     .ToList().ForEach(p => p.IsDeny = true);
        }