Esempio n. 1
0
        public virtual void CustomizeForUser(EditorItem <T> page)
        {
            List <Right>      rights   = null;
            PrivilegeObserver observer = new PrivilegeObserver();

            if (!ApplicationManager.User.IsAdmin() && page.EditedObject.oid.HasValue)
            {
                RightService service = ApplicationManager.ControllerFactory.ServiceFactory.GetRightService();
                rights = service.getUserRights(this.SubjectType.label, page.EditedObject.oid.Value);
            }
            if (this.ToolBar != null)
            {
                this.ToolBar.Customize(this.FunctionalityCode, observer, rights, page.IsReadOnly);
            }
            if (this.SideBar != null)
            {
                this.SideBar.Customize(rights, page.IsReadOnly);
            }
            CustomizeContexMenu(observer, rights, page);

            bool edit = RightsUtil.HasRight(Domain.RightType.EDIT, rights);

            page.CanRename = edit && !page.IsReadOnly;
            page.CanSave   = edit;
        }
Esempio n. 2
0
        private void customizeContextMenuForSelection()
        {
            int  count         = this.GetBrowser().Form.Grid.SelectedItems.Count;
            bool itemsSelected = count > 0;

            bool create = true;
            bool saveAs = count == 1;
            bool delete = count == 1;

            if (count == 1)
            {
                BrowserData       item     = (BrowserData)this.GetBrowser().Form.Grid.SelectedItem;
                List <Right>      rights   = null;
                PrivilegeObserver observer = new PrivilegeObserver();
                if (!ApplicationManager.User.IsAdmin())
                {
                    RightService service = ApplicationManager.ControllerFactory.ServiceFactory.GetRightService();
                    rights = service.getUserRights(this.SubjectType.label, item.oid);
                }
                saveAs = RightsUtil.HasRight(Domain.RightType.SAVE_AS, rights);
                delete = RightsUtil.HasRight(Domain.RightType.DELETE, rights);
                create = observer.hasPrivilege(this.FunctionalityCode, Domain.RightType.CREATE);
            }
            this.GetBrowser().Form.Grid.NewMenuItem.IsEnabled  = create;
            this.GetBrowser().Form.Grid.OpenMenuItem.IsEnabled = itemsSelected;
            //this.GetBrowser().Form.Grid.RenameMenuItem.IsEnabled = saveAs && count == 1;
            this.GetBrowser().Form.Grid.SaveAsMenuItem.IsEnabled = saveAs && count == 1;
            //this.GetBrowser().Form.Grid.CopyMenuItem.IsEnabled = itemsSelected && create;
            //this.GetBrowser().Form.Grid.PasteMenuItem.IsEnabled = create;
            this.GetBrowser().Form.Grid.DeleteMenuItem.IsEnabled = itemsSelected && delete;
            customizeContextMenu();
        }
Esempio n. 3
0
        /// <summary>
        /// Customize for connected user
        /// </summary>
        /// <param name="rights"></param>
        /// <param name="readOnly"></param>
        public virtual void Customize(List <Kernel.Domain.Right> rights, bool readOnly = false)
        {
            bool edit = RightsUtil.HasRight(Kernel.Domain.RightType.EDIT, rights);

            this.TargetPropertiesPanel.Visibility = edit && !readOnly ? Visibility.Visible : Visibility.Collapsed;
            this.ScopePanel.SetReadOnly(readOnly || !edit);
        }
Esempio n. 4
0
        /// <summary>
        /// Customize for connected user
        /// </summary>
        /// <param name="rights"></param>
        /// <param name="readOnly"></param>
        public virtual void Customize(List <Kernel.Domain.Right> rights, bool readOnly = false)
        {
            bool editWriteOff  = RightsUtil.HasRight(Kernel.Domain.RightType.EDIT_WRITE_OFF, rights);
            bool resetWriteOff = RightsUtil.HasRight(Kernel.Domain.RightType.RESET_RECONCILIATION, rights);

            this.CanEditWriteOff = editWriteOff;
            this.BottomGrid.ResetButton.Visibility = resetWriteOff ? Visibility.Visible : Visibility.Collapsed;
        }
Esempio n. 5
0
        /// <summary>
        /// Customize toolbar for connected user
        /// </summary>
        /// <param name="rights"></param>
        /// <param name="readOnly"></param>
        public virtual void Customize(String fuctionality, PrivilegeObserver observer, List <Domain.Right> rights, bool readOnly = false)
        {
            bool create = observer.hasPrivilege(fuctionality, Domain.RightType.CREATE);
            bool edit   = RightsUtil.HasRight(Domain.RightType.EDIT, rights);

            SaveButton.Visibility = edit && !readOnly ? Visibility.Visible : Visibility.Collapsed;
            NewButton.Visibility  = create && !readOnly ? Visibility.Visible : Visibility.Collapsed;
        }
Esempio n. 6
0
        public override void Customize(String fuctionality, PrivilegeObserver observer, List <Kernel.Domain.Right> rights, bool readOnly = false)
        {
            base.Customize(fuctionality, observer, rights, readOnly);
            bool hasRight = RightsUtil.HasRight(new Kernel.Domain.RightType[] { Kernel.Domain.RightType.EDIT, Kernel.Domain.RightType.CLEAR, Kernel.Domain.RightType.LOAD }, rights);

            saveClearRunButton.Visibility = hasRight && !readOnly ? Visibility.Visible : Visibility.Collapsed;
            runButton.Visibility          = RightsUtil.HasRight(RightType.LOAD, rights) && !readOnly ? Visibility.Visible : Visibility.Collapsed;
            clearButton.Visibility        = RightsUtil.HasRight(RightType.CLEAR, rights) && !readOnly ? Visibility.Visible : Visibility.Collapsed;
            //saveAsButton.Visibility = RightsUtil.HasRight(RightType.SAVE_AS, rights) && !readOnly ? Visibility.Visible : Visibility.Collapsed;

            applyToAllCheckBox.Visibility = runButton.Visibility == Visibility.Visible || clearButton.Visibility == Visibility.Visible ? Visibility.Visible : Visibility.Collapsed;
        }
Esempio n. 7
0
        /// <summary>
        /// Customize for connected user
        /// </summary>
        /// <param name="rights"></param>
        /// <param name="readOnly"></param>
        public virtual void Customize(List <Kernel.Domain.Right> rights, bool readOnly = false)
        {
            bool edit     = RightsUtil.HasRight(Kernel.Domain.RightType.EDIT, rights);
            bool editLine = RightsUtil.HasRight(Kernel.Domain.RightType.EDIT_CELL, rights);

            if (GridForm != null)
            {
                GridForm.SetReadOnly(readOnly || !editLine);
                GridForm.filterForm.SetReadOnly(readOnly || !edit);
            }
            if (InputGridSheetForm != null)
            {
                InputGridSheetForm.SetReadOnly(readOnly || !edit);
            }
        }
Esempio n. 8
0
        public virtual void CustomizeContexMenu(PrivilegeObserver observer, List <Right> rights, EditorItem <T> page)
        {
            if (page != null)
            {
                bool edit   = RightsUtil.HasRight(Domain.RightType.EDIT, rights);
                bool saveAs = RightsUtil.HasRight(Domain.RightType.SAVE_AS, rights);
                bool delete = RightsUtil.HasRight(Domain.RightType.DELETE, rights);
                bool create = observer.hasPrivilege(this.FunctionalityCode, Domain.RightType.CREATE);

                RefreshMenuItem.Visibility = !page.IsReadOnly ? Visibility.Visible : Visibility.Collapsed;
                DeleteMenuItem.Visibility  = delete && !page.IsReadOnly ? Visibility.Visible : Visibility.Collapsed;
                SaveAsMenuItem.Visibility  = saveAs && !page.IsReadOnly ? Visibility.Visible : Visibility.Collapsed;
                SaveMenuItem.Visibility    = edit && !page.IsReadOnly ? Visibility.Visible : Visibility.Collapsed;
                RenameMenuItem.Visibility  = saveAs && !page.IsReadOnly ? Visibility.Visible : Visibility.Collapsed;
                NewMenuItem.Visibility     = create ? Visibility.Visible : Visibility.Collapsed;
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Customize for connected user
        /// </summary>
        /// <param name="rights"></param>
        /// <param name="readOnly"></param>
        public virtual void Customize(List <Kernel.Domain.Right> rights, bool readOnly = false)
        {
            bool edit           = RightsUtil.HasRight(Kernel.Domain.RightType.EDIT, rights);
            bool editCell       = RightsUtil.HasRight(Kernel.Domain.RightType.EDIT_CELL, rights);
            bool editAllocation = RightsUtil.HasRight(Kernel.Domain.RightType.EDIT_ALLOCATION, rights);

            if (TablePropertiesPanel != null)
            {
                TablePropertiesPanel.SetReadOnly(readOnly || !edit);
            }
            if (TableCellParameterPanel != null)
            {
                TableCellParameterPanel.SetReadOnly(readOnly || !editCell);
            }
            if (AllocationPropertiesPanel != null)
            {
                AllocationPropertiesPanel.SetReadOnly(readOnly || !editAllocation);
            }
            if (SpreadSheet != null)
            {
                SpreadSheet.SetReadOnly(readOnly || !edit);
            }
        }
Esempio n. 10
0
 public override void Customize(String fuctionality, PrivilegeObserver observer, List <Kernel.Domain.Right> rights, bool readOnly = false)
 {
     base.Customize(fuctionality, observer, rights, readOnly);
     LoadButton.Visibility  = RightsUtil.HasRight(RightType.LOAD, rights) && !readOnly ? Visibility.Visible : Visibility.Collapsed;
     ClearButton.Visibility = RightsUtil.HasRight(RightType.CLEAR, rights) && !readOnly ? Visibility.Visible : Visibility.Collapsed;
 }