Beispiel #1
0
        public User(string UID, Int64 ModuleID)
        {
            SUser            = SynapseUser.LoadByUserID(UID);
            UserID           = UID;
            _CurrentModuleID = ModuleID;
            _UserControls    = new Hashtable();
            try
            {
                _Groups = SynapseProfile.LoadFromQuery("SELECT [P_ID] as ID,[FK_ModuleID],[FK_LABELID],[P_TECHNICALNAME] as TECHNICALNAME,[IS_OWNER],[LEVEL] FROM [V_Synapse_UserGroups] WHERE UserID = '" + UID + "'");

                _Modules = SynapseModule.LoadFromQuery("SELECT DISTINCT [M_ID] as ID,[LABELID],[PATH],[M_TECHNICALNAME] as TECHNICALNAME,[VERSION],[MODULECATEGORY],[VERSIONDATE],[DESCLABELID],[DEVSOURCE],[PRODSOURCE],[IS_ACTIVE],[IS_REQUESTABLE] FROM [V_Synapse_UserGroups] WHERE UserID = '" + UID + "' OR M_ID=1 ORDER BY MODULECATEGORY");

                CSC = ControlSecurity.Load("WHERE (UserID = '" + UserID + "' OR UserID = 'Everybody') AND (FK_MODULE_ID=" + ModuleID + " OR FK_MODULE_ID=1)");
                foreach (ControlSecurity C in CSC)
                {
                    try
                    {
                        _UserControls.Add(C.FORM_NAME + C.CTRL_NAME, C);
                    }
                    // TODO: Catch more specific exception
                    catch (Exception ex)
                    {
                        SynapseForm.SynapseLogger.Error(ex.Message);
                    }
                }
            }
            // TODO: Catch more specific exception
            catch (Exception ex)
            {
                SynapseForm.SynapseLogger.Error(ex.Message);
            }
        }
Beispiel #2
0
        public static string GetControlGroups(Int64 ModuleID, string formName, string controlName)
        {
            string query = "SELECT     dbo.Synapse_Security_Profile.ID, dbo.Synapse_Security_Profile.FK_MODULEID, dbo.Synapse_Security_Profile.FK_LABELID, " +
                           "dbo.Synapse_Security_Profile.TECHNICALNAME, dbo.Synapse_Security_Profile.IS_OWNER, dbo.Synapse_Security_Profile.[LEVEL] " +
                           "FROM         dbo.Synapse_Security_Control INNER JOIN " +
                           "dbo.[Synapse_Security_Profile Control] ON dbo.Synapse_Security_Control.ID = dbo.[Synapse_Security_Profile Control].FK_CONTROLID INNER JOIN " +
                           "dbo.Synapse_Security_Profile ON dbo.[Synapse_Security_Profile Control].FK_PROFILEID = dbo.Synapse_Security_Profile.ID";
            string groups = string.Empty;
            IList <SynapseProfile> ctrl_security = SynapseProfile.LoadFromQuery(query + " WHERE FK_MODULE_ID = " + ModuleID + " AND FORM_NAME = '" + formName + "' AND CTRL_NAME = '" + controlName + "'");

            foreach (SynapseProfile P in ctrl_security)
            {
                if (!groups.Contains(P.TECHNICALNAME + "/"))
                {
                    groups += P.TECHNICALNAME + "/";
                }
            }
            if (groups == string.Empty)
            {
                return("Everybody");
            }
            else
            {
                return(groups);
            }
        }
Beispiel #3
0
 public void ReloadModulesAndGroups()
 {
     try
     {
         _Groups  = SynapseProfile.LoadFromQuery("SELECT [P_ID] as ID,[FK_ModuleID],[FK_LABELID],[P_TECHNICALNAME] as TECHNICALNAME,[IS_OWNER],[LEVEL] FROM [V_Synapse_UserGroups] WHERE UserID = '" + UserID + "'");
         _Modules = SynapseModule.LoadFromQuery("SELECT DISTINCT [M_ID] as ID,[LABELID],[PATH],[M_TECHNICALNAME] as TECHNICALNAME,[VERSION],[MODULECATEGORY],[VERSIONDATE],[DESCLABELID],[DEVSOURCE],[PRODSOURCE],[IS_ACTIVE],[IS_REQUESTABLE] FROM [V_Synapse_UserGroups] WHERE UserID = '" + UserID + "' OR M_ID=1 ORDER BY MODULECATEGORY");
     }
     // TODO: Catch more specific exception
     catch (Exception ex)
     {
         SynapseForm.SynapseLogger.Error(ex.Message);
     }
 }
        private void Delete_Module(object sender, EventArgs e)
        {
            if (MessageBox.Show(GetLabel("Quest.0003"), GetLabel("Quest"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
            {
                SynapseModule _module = (SynapseModule)olvModules.SelectedObject;
                IList <SynapseProfile_Control> _profileControl = SynapseProfile_Control.LoadFromQuery("SELECT dbo.[Synapse_Security_Profile Control].* FROM dbo.[Synapse_Security_Profile Control] INNER JOIN dbo.Synapse_Security_Profile ON dbo.[Synapse_Security_Profile Control].FK_PROFILEID = dbo.Synapse_Security_Profile.ID INNER JOIN dbo.Synapse_Module ON dbo.Synapse_Security_Profile.FK_MODULEID = dbo.Synapse_Module.ID WHERE (dbo.Synapse_Module.ID = " + _module.ID + ")");
                IList <SynapseUser_Profile>    _userProfile    = SynapseUser_Profile.LoadFromQuery("SELECT dbo.[Synapse_Security_User Profile].* FROM dbo.[Synapse_Security_User Profile] INNER JOIN dbo.Synapse_Security_Profile ON dbo.[Synapse_Security_User Profile].FK_SECURITY_PROFILE = dbo.Synapse_Security_Profile.ID INNER JOIN dbo.Synapse_Module ON dbo.Synapse_Security_Profile.FK_MODULEID = dbo.Synapse_Module.ID WHERE (dbo.Synapse_Module.ID = " + _module.ID + ")");
                IList <SynapseProfile>         _profile        = SynapseProfile.LoadFromQuery("SELECT dbo.Synapse_Security_Profile.* FROM dbo.Synapse_Security_Profile INNER JOIN dbo.Synapse_Module ON dbo.Synapse_Security_Profile.FK_MODULEID = dbo.Synapse_Module.ID WHERE (dbo.Synapse_Module.ID = " + _module.ID + ")");
                IList <SynapseControl>         _control        = SynapseControl.Load("WHERE FK_MODULE_ID=" + _module.ID);

                SynapseCore.Database.DBFunction.StartTransaction();
                try
                {
                    foreach (SynapseProfile_Control obj in _profileControl)
                    {
                        obj.delete();
                    }
                    foreach (SynapseUser_Profile obj in _userProfile)
                    {
                        obj.delete();
                    }
                    foreach (SynapseProfile obj in _profile)
                    {
                        obj.delete();
                    }
                    foreach (SynapseControl obj in _control)
                    {
                        obj.delete();
                    }
                    foreach (SynapseLabel obj in ((SynapseModule)olvModules.SelectedObject).FriendlyName.Labels)
                    {
                        obj.delete();
                    }
                    foreach (SynapseLabel obj in ((SynapseModule)olvModules.SelectedObject).Description.Labels)
                    {
                        obj.delete();
                    }

                    _module.delete();

                    SynapseCore.Database.DBFunction.CommitTransaction();

                    listModule();
                }
                catch (Exception ex)
                {
                    SynapseCore.Database.DBFunction.RollbackTransaction();
                    MessageBox.Show("Data not deleted from Database:" + ex.Message, "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }