コード例 #1
0
ファイル: ServersController.cs プロジェクト: zippyy/ArkBot
        private static AccessControlViewModel BuildViewModelForAccessControl(IConfig config)
        {
            var ac = new AccessControlViewModel {
            };

            if (config.AccessControl != null)
            {
                foreach (var fg in config.AccessControl)
                {
                    var acfg = new Dictionary <string, List <string> >();
                    ac[fg.Key] = acfg;

                    if (fg.Value == null)
                    {
                        continue;
                    }

                    foreach (var rf in fg.Value)
                    {
                        acfg[rf.Key] = rf.Value;
                    }
                }
            }

            return(ac);
        }
コード例 #2
0
        public AccessControlView(AccessControlViewModel viewModel)
        {
            InitializeComponent();
            this.DataContext = viewModel;

            this.Loaded += (s, e) =>
            {
                int count = tcUserTab.Items.Count;
                if (count > 0)
                {
                    //TabItem userTab = (TabItem)tcUserTab.Items[0];
                    //userTab.IsEnabled = viewModel.LoggedInUser.Role.UserRight.CanSetupUser;

                    //TabItem roleTab = (TabItem)tcUserTab.Items[1];
                    //roleTab.IsEnabled = viewModel.LoggedInUser.Role.UserRight.CanSetupRole;

                    //TabItem rightTab = (TabItem)tcUserTab.Items[2];
                    //rightTab.IsEnabled = viewModel.LoggedInUser.Role.UserRight.CanSetupRight;

                    //TabItem assignRightToRoleTab = (TabItem)tcUserTab.Items[3];
                    //assignRightToRoleTab.IsEnabled = viewModel.LoggedInUser.Role.UserRight.CanAssignRightToRole;

                    //TabItem assignRoleToUserTab = (TabItem)tcUserTab.Items[4];
                    //assignRoleToUserTab.IsEnabled = viewModel.LoggedInUser.Role.UserRight.CanAssignRoleToUser;
                }
            };
        }