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 System.Security.IPermission Intersect(System.Security.IPermission target) { Report("{0}.Intersect(...)", this.GetType().FullName); if (target == null) { return null; } VerifyTargetType(target); GisaPrincipalPermission GisaTargetPermission = (GisaPrincipalPermission)target; GisaPrincipalPermission Result = new GisaPrincipalPermission(mPrincipal, null); ArrayList All = new ArrayList(); if (this.mClassName != null && GisaTargetPermission.mClassName != null && this.mClassName.Equals(GisaTargetPermission.mClassName)) { Result.mClassName = (string)(this.mClassName.Clone()); } else { return null; } if (this.mOperations != null && GisaTargetPermission.mOperations != null) { foreach (string op in this.mOperations) { if (System.Array.IndexOf(GisaTargetPermission.mOperations, op) >= GisaTargetPermission.mOperations.GetLowerBound(0)) { All.Add(op); } } } if (All.Count == 0) { return null; } else { Result.mOperations = new string[All.Count - 1]; All.CopyTo(Result.mOperations); return Result; //Nitro: TODO: INSTANT C# TODO TASK: The following 'ReDim' could not be resolved. A possible reason may be that the object of the ReDim was not declared as an array. /* ReDim Result.mOperations(All.Count - 1); All.CopyTo(Result.mOperations); return Result; */ } }
public System.Security.IPermission Union(System.Security.IPermission target) { Report("{0}.Union(...)", this.GetType().FullName); if (target == null) { return new GisaPrincipalPermission(mPrincipal, mClassName, this.mOperations); } else { VerifyTargetType(target); GisaPrincipalPermission GisaTargetPermission = (GisaPrincipalPermission)target; GisaPrincipalPermission Result = new GisaPrincipalPermission(mPrincipal, null); ArrayList All = new ArrayList(); if (this.mClassName != null && GisaTargetPermission.mClassName != null && this.mClassName.Equals(GisaTargetPermission.mClassName)) { Result.mClassName = (string)(this.mClassName.Clone()); } else { Result.mClassName = null; } if (this.mOperations != null) { All.AddRange(this.mOperations); } if (GisaTargetPermission.mOperations != null) { foreach (string s in GisaTargetPermission.mOperations) { if (! (All.Contains(s))) { All.Add(s); } } } //Nitro: TODO: INSTANT C# TODO TASK: The following 'ReDim' could not be resolved. A possible reason may be that the object of the ReDim was not declared as an array. Result.mOperations = new string[All.Count - 1]; All.CopyTo(Result.mOperations); return Result; } }
public System.Security.IPermission Copy() { Report("{0}.Copy()", this.GetType().FullName); GisaPrincipalPermission Result = new GisaPrincipalPermission(mPrincipal, null); if (this.mOperations != null) { Result.mOperations = (string[])(this.mOperations.Clone()); } if (this.mClassName != null) { Result.mClassName = (string)(this.mClassName.Clone()); } return Result; }
public bool IsSubsetOf(System.Security.IPermission target) { Report("{0}.IsSubsetOf(...)", this.GetType().FullName); //FIXME: mClassName missing if (target == null) { return this.mOperations == null; } VerifyTargetType(target); if (! (this == target)) { GisaPrincipalPermission GisaTargetPermission = (GisaPrincipalPermission)target; if (this.mOperations != null) { if (GisaTargetPermission.mOperations != null) { foreach (string s in this.mOperations) { if (System.Array.IndexOf(((GisaPrincipalPermission)target).mOperations, s) < ((GisaPrincipalPermission)target).mOperations.GetLowerBound(0)) { return false; } } } } else { return GisaTargetPermission.mOperations == null; } } return 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(); } }