Ejemplo n.º 1
0
        public static PermissoesHelper.PermissionType CalculateEffectivePermissions(GISADataset.TrusteeRow tRow, GISADataset.FunctionOperationRow foRow)
        {
            GISADataset.UserGroupsRow[]       ugRows  = null;
            GISADataset.TrusteePrivilegeRow[] tpuRows = null;
            tpuRows = (GISADataset.TrusteePrivilegeRow[])(GisaDataSetHelper.GetInstance().TrusteePrivilege.Select(string.Format("IDTrustee={0} AND IDTipoFunctionGroup={1} AND IdxTipoFunction={2} AND IDTipoOperation={3}", tRow.ID, foRow.IDTipoFunctionGroup, foRow.IdxTipoFunction, foRow.IDTipoOperation)));

            if (tpuRows.Length > 0)
            {
                if (tpuRows[0].IsGrant)
                {
                    return(PermissionType.ExplicitGrant);
                }
                else
                {
                    return(PermissionType.ExplicitDeny);
                }
            }

            if (tRow.CatCode.Equals("USR"))
            {
                if (tRow.GetTrusteeUserRows().Length > 0)
                {
                    ugRows = tRow.GetTrusteeUserRows()[0].GetUserGroupsRows();
                    return(CalculateGroupPermissionsModulos(ugRows, foRow));
                }
            }

            return(PermissionType.ImplicitDeny);
        }
Ejemplo n.º 2
0
		protected override void UpdateListViewItem(ListViewItem li, GISADataset.TrusteeRow t)
		{
			base.UpdateListViewItem(li, t);
            //TODO: if(! (t.GetTrusteeUserRows()[0].IsFullNameNull()))
            if (t.GetTrusteeUserRows().Length > 0 && !(t.GetTrusteeUserRows()[0].IsFullNameNull()))
				li.SubItems[ColumnHeaderFullName.Index].Text = t.GetTrusteeUserRows()[0].FullName;
			else
				li.SubItems[ColumnHeaderFullName.Index].Text = "";
		}
Ejemplo n.º 3
0
        public static PermissionType CalculateEffectivePermissions(GISADataset.TrusteeRow tRow, GISADataset.TipoOperationRow opRow, GISADataset.DepositoRow depRow)
        {
            var tdpRow = GisaDataSetHelper.GetInstance().TrusteeDepositoPrivilege.Cast <GISADataset.TrusteeDepositoPrivilegeRow>()
                         .SingleOrDefault(r => r.RowState != DataRowState.Deleted && r.IDTrustee == tRow.ID && r.IDTipoOperation == opRow.ID && r.IDDeposito == depRow.ID);

            if (tdpRow != null)
            {
                return(tdpRow.IsGrant ? PermissionType.ExplicitGrant : PermissionType.ExplicitDeny);
            }

            if (tRow.CatCode.Equals("USR"))
            {
                if (tRow.GetTrusteeUserRows().Length > 0)
                {
                    var ugRows = tRow.GetTrusteeUserRows()[0].GetUserGroupsRows();
                    return(CalculateGroupPermissionsDepositos(ugRows, opRow, depRow));
                }
            }

            return(PermissionType.ImplicitDeny);
        }
Ejemplo n.º 4
0
        public static void DeleteTrusteeAndRelatedRows(GISADataset.TrusteeRow truRow)
        {
            GISADataset.TrusteeGroupRow[] grpRows = truRow.GetTrusteeGroupRows();
            GISADataset.TrusteeUserRow[]  usrRows = truRow.GetTrusteeUserRows();
            GISADataset.UserGroupsRow[]   ugRows  = null;
            List <long> UserIDs = new List <long>();

            if (grpRows.Length > 0)
            {
                ugRows = grpRows[0].GetUserGroupsRows();
                foreach (GISADataset.UserGroupsRow ugRow in ugRows)
                {
                    UserIDs.Add(ugRow.IDUser);
                }
            }
            else if (usrRows.Length > 0)
            {
                ugRows = usrRows[0].GetUserGroupsRows();
            }

            GISADataset.TrusteePrivilegeRow[] tpRows = (GISADataset.TrusteePrivilegeRow[])(GisaDataSetHelper.GetInstance().TrusteePrivilege.Select(string.Format("IDTrustee={0}", truRow.ID)));

            foreach (GISADataset.TrusteePrivilegeRow tpRow in tpRows)
            {
                tpRow.Delete();
            }

            if (ugRows != null)
            {
                foreach (GISADataset.UserGroupsRow ugRow in ugRows)
                {
                    ugRow.Delete();
                }
            }

            foreach (GISADataset.TrusteeGroupRow grpRow in grpRows)
            {
                grpRow.Delete();
            }

            foreach (GISADataset.TrusteeUserRow usrRow in usrRows)
            {
                foreach (GISADataset.TrusteeUserRow uRowAuth in usrRow.GetTrusteeUserRows())
                {
                    uRowAuth.SetIDTrusteeUserDefaultAuthorityNull();
                }

                usrRow.Delete();
            }

            truRow.Delete();

            try
            {
                PersistencyHelper.save();
                PersistencyHelper.cleanDeletedData();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                throw;
            }
        }