示例#1
0
        private void WSdel(HttpContext context, int idEASet)
        {
            IEntAssignmentSet         engine = new IEntAssignmentSet(HELPERS.NewOdbcConn());
            returnGetEntAssignmentSet props  = engine.GetEntAssignmentSet(idEASet);

            if (props.Status != "WORKSPACE")
            {
                throw new Exception("Only open workspaces may be deleted.  Archived or active entitlement sets may not be deleted.");
            }
            if (props.UserID != this.session.idUser)
            {
                throw new Exception("Only the owner has permission to delete a workspace.");
            }

            engine.SetEntAssignmentSet
                (idEASet, "deleted", DateTime.Now,
                props.Commentary, props.SubProcessID, props.UserID, props.DATETIMEbirth);

            if (idEASet == this.session.idWorkspace)
            {
                // Make sure this user is not still "logged in" to the now-dead workspace
                this.session.idWorkspace          = -1;
                this.session.idUserWorkspaceOwner = -1;
            }
            context.Response.Write("OK\n");
        }
示例#2
0
        /* Passing rolename as null is OK: generates just metadata about the entset context */
        private RoleMetadata GenerateRoleMetadata(string rolename, int wsID)
        {
            OdbcConnection tempconn = HELPERS.NewOdbcConn();

            RoleMetadata newbee = new RoleMetadata();

            IEntAssignmentSet engineEASet = new IEntAssignmentSet(tempconn);

            returnGetEntAssignmentSet eas = engineEASet.GetEntAssignmentSet(wsID);

            newbee.WSid         = wsID;
            newbee.WSstatus     = eas.Status;
            newbee.WSownerident =
                UserIdentificationString(eas.UserID, tempconn);
            newbee.WSdateOfImport =
                (eas.Status == "WORKSPACE") ? eas.DATETIMEbirth.ToString() :
                eas.DATETIMElock.ToString();


            newbee.ROLEownersident = new Queue <RoleMetadataOwner>();

            if (rolename != null)
            {
                int roleID;


                IBusRole            engineBR = new IBusRole(tempconn);
                returnListBusRole[] retFindBRole
                    = engineBR.ListBusRole(null, "\"Name\" = ?", new string[] { rolename }, "");

                if (retFindBRole.Length < 1)
                {
                    // If we get here, it's probably the case that rolename ends in "//DEL",
                    // i.e. representing a deleted role.
                    // throw new Exception("Rolename " + rolename + " not found");
                    roleID = -1;
                    // By setting roleID to this, we ensure that the list of role owners
                    // (computed by the logic immediately below)
                    // will just create an empty list.
                }
                else
                {
                    roleID = retFindBRole[0].ID;
                }

                newbee.rolename = rolename;

                IBusRoleOwner engineBRole = new IBusRoleOwner(tempconn);
                returnListBusRoleOwnerByBusRole[] roleowners
                    = engineBRole.ListBusRoleOwnerByBusRole(null, roleID);

                if (roleowners.Length < 1)
                {
                    RoleMetadataOwner baby = new RoleMetadataOwner();
                    baby.EID       = "";
                    baby.geography = "";
                    baby.rank      = "";
                    baby.name      = "";
                    newbee.ROLEownersident.Enqueue(baby);
                }
                else
                {
                    foreach (returnListBusRoleOwnerByBusRole roleowner in roleowners)
                    {
                        RoleMetadataOwner baby = new RoleMetadataOwner();
                        baby.EID       = roleowner.EID;
                        baby.geography = roleowner.Geography;
                        baby.rank      = roleowner.RankFriendly;
                        baby.name      = UserFriendlyName(roleowner.EID, tempconn);
                        newbee.ROLEownersident.Enqueue(baby);
                    }
                }
            }

            return(newbee);
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            session.ObtainWorkspaceContext();


            if (IsPostBack)
            {
                return;
            }



            PANELcond_Editable.Visible = false;
            PANELcond_ReadOnly.Visible = false;
            PANELcond_ViewOtherUserWorkspace.Visible = false;

            PANELcond_ViewActiveReadOnly.Visible     = false;
            PANELcond_ViewHistoricalReadOnly.Visible = false;

            IEntAssignmentSet engineEASET = new IEntAssignmentSet(HELPERS.NewOdbcConn());


            int IDeaset = -1;


            // STICKINESS: If the URL does not specifically demand a particular
            // workspace via query param, then draw it in from the session parameter.
            // Only if no session preference for a particular workspace would you then
            // default to the current open-for-editing workspace.
            if (this.Request.Params["WSID"] == null)
            {
                // URL does not explicitly request a particular EASet
                if (Session["INTcurWS"].ToString() != "")
                {
                    IDeaset = int.Parse(Session["INTcurWS"].ToString());
                }
            }
            else
            {
                IDeaset = int.Parse(this.Request.Params["WSID"].ToString());
            }

            if (IDeaset < 0)
            {
                // LAST RESORT:
                IDeaset = session.idWorkspace;
            }



            if (IDeaset != session.idWorkspace)
            {
                // IMPORTANT: we are going back in time and looking at a frozen state.
                // This is NOT a workspace!

                Session["INTcurWS"] = IDeaset;


                // Get info about this snapshot
                targetEASet = engineEASET.GetEntAssignmentSet(IDeaset);


                if (targetEASet.Status.ToLower() == "active")
                {
                    PANELcond_ViewActiveReadOnly.Visible = true;
                }
                else
                {
                    PANELcond_ViewHistoricalReadOnly.Visible = true;
                }
            }
            else
            {
                Session["INTcurWS"] = IDeaset;

                if (IDeaset >= 0)
                {
                    // THIS IS A WORKSPACE !!
                    // THIS IS A WORKSPACE !!
                    // THIS IS A WORKSPACE !!
                    // It might not belong to "me" but it is definitely a workspace
                    targetEASet = engineEASET.GetEntAssignmentSet(session.idWorkspace);
                    if (session.isWorkspaceOwner)
                    {
                        PANELcond_Editable.Visible = true;
                    }
                    else
                    {
                        PANELcond_ViewOtherUserWorkspace.Visible = true;
                    }
                }
                else
                {
                    // There IS no workspace!
                    PANELcond_ReadOnly.Visible = true;
                    Grid1.Visible = false;
                }
            }
        }
示例#4
0
        /*
         * The version 2 coalesces vectors that are identical
         * except for the business role.  Right now it uses a simplistic
         * algorithm that includes the commentary column (not a good thing)
         * and that doesn't look for variations that would be considered
         * not important (whitespaces?).
         */
        public static void ImportDataTableAsNewEntAssignmentSet_v2(
            DataTable dt, int IDuser, int IDsubpr, System.Data.Odbc.OdbcConnection conn)
        {
            IUser             Iuser  = new IUser(conn);
            ISubProcess       Isubpr = new ISubProcess(conn);
            IEntAssignmentSet Ieaset = new IEntAssignmentSet(conn);
            IEntAssignment    Iea    = new IEntAssignment(conn);
            IEntitlement      Ientit = new IEntitlement(conn);
            IBusRole          Ibr    = new IBusRole(conn);

            int IDneweas =
                Ieaset.NewEntAssignmentSet(false, DateTime.Now, "Import from CSV", IDsubpr, IDuser);

            // These Get function are only useful for a read-only view of fields;
            // not for generating subordinate entities.
            returnGetEntAssignmentSet neweas = Ieaset.GetEntAssignmentSet(IDneweas);

            IEnumerator <System.Data.DataRow> x =
                (IEnumerator <System.Data.DataRow>)dt.Rows.GetEnumerator();


            Hashtable signatures = new Hashtable();

            while (x.MoveNext())
            {
                int IDbusrole;

                if (x.Current[0].Equals(System.DBNull.Value))
                {
                    // Ignore any line with no value in the first field.
                    // Often the end of the csv file has just lots of blank rows.
                    continue;
                }

                // Make sure business role object exists; create if not.
                string busrole         = (string)(x.Current["BusRole"]);
                returnListBusRole[] xx = Ibr.ListBusRole(null, "\"Name\" like ?",
                                                         new string[] { busrole }, "");
                if (xx.Length < 1)
                {
                    // MUST ADD NEW ONE
                    IDbusrole =
                        Ibr.NewBusRole(busrole, x.Current["Business Role Description"] as string, IDsubpr);
                }
                else
                {
                    IDbusrole = xx[0].ID;
                }


                /* Create a "signature" for this entitlement vector so we can
                 * register it and also see if it's been seen before.
                 */
                string thisSignature =
                    x.Current["Standard Activity"] as string + "/\\" +
                    x.Current["Type"] as string + "/\\" +
                    x.Current["System"] as string + "/\\" +
                    x.Current["Platform"] as string + "/\\" +
                    x.Current["Entitlement Description"] as string + "/\\" +
                    x.Current["Entitlement Value"] as string + "/\\" +
                    "" + "/\\" +
                    x.Current["Authorization Object"] as string + "/\\" +
                    x.Current["Field-Level Security Name"] as string + "/\\" +
                    x.Current["Field-Level Security Value"] as string + "/\\" +
                    x.Current["4th Level Security Name"] as string + "/\\" +
                    x.Current["4th Level Security Value"] as string;

                if (signatures.ContainsKey(thisSignature))
                {
                    // Already seen before, so just add this bus.role
                    // to the list of busroles tied to this.
                    int IDnewent = (int)signatures[thisSignature];

                    int IDnewentass = Iea.NewEntAssignment
                                          (IDneweas, IDbusrole, IDnewent);
                }
                else
                {
                    int IDnewent = Ientit.NewEntitlement(
                        x.Current["Standard Activity"] as string,
                        x.Current["Type"] as string,
                        x.Current["System"] as string,
                        x.Current["Platform"] as string,
                        x.Current["Entitlement Description"] as string,
                        x.Current["Entitlement Value"] as string);

                    Ientit.SetEntitlement(IDnewent,
                                          x.Current["Standard Activity"] as string,
                                          x.Current["Type"] as string,
                                          x.Current["System"] as string,
                                          x.Current["Platform"] as string,
                                          x.Current["Entitlement Description"] as string,
                                          x.Current["Entitlement Value"] as string,
                                          "",
                                          x.Current["Authorization Object"] as string,
                                          x.Current["Field-Level Security Name"] as string,
                                          x.Current["Field-Level Security Value"] as string,
                                          x.Current["4th Level Security Name"] as string,
                                          x.Current["4th Level Security Value"] as string,
                                          x.Current["Additional Comments"] as string,
                                          x.Current["Manifest Value"] as string);

                    int IDnewentass = Iea.NewEntAssignment
                                          (IDneweas, IDbusrole, IDnewent);

                    signatures.Add(thisSignature, IDnewent);
                }
            }
        }