public override void LoadData(DataRow CurrentDataRow, IDbConnection conn) { IsLoaded = false; CurrentFRDBase = (GISADataset.FRDBaseRow)CurrentDataRow; try { GisaPrincipalPermission gpp = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), "GISA.SlavePanelFedora", GisaPrincipalPermission.READ); gpp.Demand(); } catch (System.Security.SecurityException) { IsReadOnlyMode = true; } splitContainerOdsReadOnly.Visible = IsReadOnlyMode; controlObjetoDigital1.Visible = !IsReadOnlyMode; if (IsReadOnlyMode) { if (SessionHelper.AppConfiguration.GetCurrentAppconfiguration().IsFedoraEnable()) { var rhRow = CurrentFRDBase.NivelRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().First(); FedoraRule.Current.LoadObjDigitalData(GisaDataSetHelper.GetInstance(), CurrentFRDBase.IDNivel, rhRow.IDTipoNivelRelacionado, conn); } } else { odHelper.currentNivel = CurrentFRDBase.NivelRow; odHelper.LoadData(); } IsLoaded = true; }
public override void ModelToView() { FillQualidadeImagem(); rbNiveisEPs.Checked = GlobalConfigRow.NiveisOrganicos; rbNiveisTFs.Checked = ! GlobalConfigRow.NiveisOrganicos; rbGestaoIntegrada.Checked = GlobalConfigRow.GestaoIntegrada; rbGestaoNaoIntegrada.Checked = ! GlobalConfigRow.GestaoIntegrada; txtMaxNumResultados.Text = GlobalConfigRow.MaxNumResultados.ToString(); txtMaxNumDocumentos.Text = GlobalConfigRow.MaxNumDocumentos.ToString(); txtURLBase.Text = GlobalConfigRow.IsURLBaseNull() ? "" : GlobalConfigRow.URLBase; txt_metrosLinearesTotais.Text = GlobalConfigRow.IsMetrosLinearesTotaisNull() ? "" : GlobalConfigRow.MetrosLinearesTotais.ToString(); txtServerUrl.Text = GlobalConfigRow.IsFedoraServerUrlNull() ? "" : GlobalConfigRow.FedoraServerUrl; txtUsername.Text = GlobalConfigRow.IsFedoraUsernameNull() ? "" : GlobalConfigRow.FedoraUsername; txtPassword.Text = GlobalConfigRow.IsFedoraPasswordNull() ? "" : GlobalConfigRow.FedoraPassword; txtGisaInternet.Text = GlobalConfigRow.IsUrlGisaInternetNull() ? "" : GlobalConfigRow.UrlGisaInternet; cbQualidadeImagem.SelectedItem = GlobalConfigRow.IsQualidadeImagemNull() ? FedoraHelper.TranslateQualityEnum(Quality.Low) : GlobalConfigRow.QualidadeImagem; chkActivar.Checked = GlobalConfigRow.URLBaseActivo; // Valores por omissão chkValoresOmissao.Checked = GlobalConfigRow.IsApplyDefaultValuesNull() ? false : GlobalConfigRow.ApplyDefaultValues; txtCondicoesAcesso.Text = GlobalConfigRow.IsCondicaoDeAcessoNull() ? "" : GlobalConfigRow.CondicaoDeAcesso; txtCondicoesReproducao.Text = GlobalConfigRow.IsCondicaoDeReproducaoNull() ? "" : GlobalConfigRow.CondicaoDeReproducao; LoadAlfabetoAndLingua(); grpValoresOmissão.Enabled = chkValoresOmissao.Checked; IDbConnection conn = GisaDataSetHelper.GetConnection(); long nivelEstruturalCount = 0; try { conn.Open(); Trace.WriteLine("<getNivelEstruturalCount>"); nivelEstruturalCount = NivelRule.Current.GetNivelEstruturalCount(conn); Trace.WriteLine("</getNivelEstruturalCount>"); if (nivelEstruturalCount > 0) { grpFRDs.Enabled = false; grpAvaliacao.Enabled = false; } } catch (Exception ex) { Trace.WriteLine(ex); throw ex; } finally { conn.Close(); } try { GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), this.GetType().FullName, GisaPrincipalPermission.WRITE); tempWith1.Demand(); } catch (System.Security.SecurityException) { #if ! ALLPRODUCTPERMISSIONS this.Enabled = false; #endif } // este handler tem de ser adicionado no fim do activate para que a população inicial do controlo não lance o evento rbNiveisEPs.CheckedChanged += rbNiveisEPs_CheckedChanged; // carregar informação referente aos modelos de avaliação PopulateListaModelosAvaliacao(); UpdateToolBarButtonsLista(); UpdateToolBarButtonsModelos(); this.Visible = true; }
public override void ModelToView() { // se nao existir um contexto definido os slavepanels não devem ser apresentados if (CurrentTrustee == null || CurrentTrustee.RowState == DataRowState.Detached || CurrentContext.Trustee.RowState == DataRowState.Detached) { this.Visible = false; return; } this.Visible = true; GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (selectedPanel.IsLoaded && ! selectedPanel.IsPopulated) selectedPanel.ModelToView(); try { GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), this.GetType().FullName, GisaPrincipalPermission.WRITE); tempWith1.Demand(); } catch (System.Security.SecurityException) { GUIHelper.GUIHelper.makeReadOnly(this.GisaPanelScroller); } }
public override void ModelToView() { try { ((frmMain)TopLevelControl).EnterWaitMode(); // se nao existir um contexto definido os slavepanels não devem ser apresentados if (CurrentDeposito == null || CurrentDeposito.RowState == DataRowState.Detached) { this.Visible = false; return; } try { GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), this.GetType().FullName, GisaPrincipalPermission.WRITE); tempWith1.Demand(); } catch (System.Security.SecurityException) { GUIHelper.GUIHelper.makeReadOnly(this.GisaPanelScroller); } this.Visible = true; GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (selectedPanel.IsLoaded && !selectedPanel.IsPopulated) { long startTicks = 0; startTicks = DateTime.Now.Ticks; selectedPanel.ModelToView(); Debug.WriteLine("Time dispend model to view " + selectedPanel.ToString() + ": " + new TimeSpan(DateTime.Now.Ticks - startTicks).ToString()); } } finally { ((frmMain)TopLevelControl).LeaveWaitMode(); } }
public override void LoadData() { try { GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), this.GetType().FullName, GisaPrincipalPermission.WRITE); tempWith1.Demand(); } catch (System.Security.SecurityException) { #if ! ALLPRODUCTPERMISSIONS GUIHelper.GUIHelper.makeReadOnly(this.GisaPanelScroller); #endif } base.LoadData(); }
// verifica se existe permissão de execução da operação especificada // no contexto do painel especificado public bool CheckPermission(string ClassFullName, string operation) { try { GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), ClassFullName, operation); tempWith1.Demand(); } catch (System.Security.SecurityException) { return false; } return true; }
private bool CheckTipoFunctionPermissions(GISADataset.TipoFunctionRow tf, string permission) { try { GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), tf.ClassName, permission); tempWith1.Demand(); return true; } catch (System.Security.SecurityException) { return false; } }
// Devolver True se houver algum privilegio definido para a função especificada private bool HasFunctionAccess(GISADataset.TipoFunctionGroupRow tfg, GISADataset.TipoFunctionRow tf) { // Usar o GUIOrder=0 como indicacao que a função deve ser escondida if (tf.GUIOrder == 0) return false; foreach (GISADataset.TrusteePrivilegeRow tp in SessionHelper.GetGisaPrincipal().TrusteePrivileges) { // se pertencer ao grupo certo if (tfg.ID == tp.IDTipoFunctionGroup && tp.IDTipoFunctionGroup == tf.IDTipoFunctionGroup) { #if ALLPRODUCTPERMISSIONS return true; #else // se se tratar da função especificada if (tp.IdxTipoFunction == tf.idx) { try { GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), tf.ClassName, GisaPrincipalPermission.READ); tempWith1.Demand(); return true; } catch (System.Security.SecurityException) { Trace.WriteLine(string.Format("READ privilege not found for {0} {1}", tfg.Name, tf.Name)); } } #endif } } return false; }
public override void ModelToView() { try { ((frmMain)TopLevelControl).EnterWaitMode(); // se nao existir um contexto definido os slavepanels não devem ser apresentados if (CurrentFRDBase == null || CurrentFRDBase.RowState == DataRowState.Detached || CurrentContext.NivelEstrututalDocumental.RowState == DataRowState.Detached) { this.Visible = false; return; } this.Visible = true; GISAPanel selectedPanel = null; try { GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), this.GetType().FullName, GisaPrincipalPermission.WRITE); tempWith1.Demand(); if (! PermissoesHelper.AllowEdit) throw new System.Security.SecurityException(); else if (! LastStateEditPermisson) { // Para garantir que o estado dos controlos está de acordo com as regras definidas quando a transição é feita // de um contexto sem permissão de edição para um com, é necessário colocar o estado desses controlos a true // para em seguida se redefinir esse estado no ModelToViewPanels() selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (selectedPanel.IsLoaded && ! selectedPanel.IsPopulated) selectedPanel.ModelToView(); GUIHelper.GUIHelper.makeReadable(selectedPanel); } else { selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (selectedPanel.IsLoaded && ! selectedPanel.IsPopulated) { long startTicks = 0; startTicks = DateTime.Now.Ticks; selectedPanel.ModelToView(); Debug.WriteLine("Time dispend model to view " + selectedPanel.ToString() + ": " + new TimeSpan(DateTime.Now.Ticks - startTicks).ToString()); } } LastStateEditPermisson = true; } catch (System.Security.SecurityException) { selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; selectedPanel.ModelToView(); LastStateEditPermisson = false; GUIHelper.GUIHelper.makeReadOnly(selectedPanel); } } finally { ((frmMain)TopLevelControl).LeaveWaitMode(); } }