Exemple #1
0
        private void Form_Load(object sender, EventArgs e)
        {
            _Storage = (IAzManStorage)Session["storage"];

            if (Session["selectedObject"] as IAzManStore != null)
            {
                _Store = Session["selectedObject"] as IAzManStore;
            }
            if (Session["selectedObject"] as IAzManStoreGroup != null)
            {
                _StoreGroup = this.Session["selectedObject"] as IAzManStoreGroup;
                _Store      = _StoreGroup.Store;
            }
            if (Session["selectedObject"] as IAzManApplicationGroup != null)
            {
                _ApplicationGroup = Session["selectedObject"] as IAzManApplicationGroup;
                _Application      = _ApplicationGroup.Application;
                _Store            = _Application.Store;
            }

            _Mode = Mode.Update;

            SetAttributes();
            LoadTab();
        }
        private void Form_Load(object sender, EventArgs e)
        {
            _Storage = (IAzManStorage)Session["storage"];

            if (Session["selectedObject"] as IAzManStore != null)
            {
                _Store = Session["selectedObject"] as IAzManStore;
            }
            if (Session["selectedObject"] as IAzManApplication != null)
            {
                _Application = Session["selectedObject"] as IAzManApplication;
                _Store       = _Application.Store;
            }
            if (Session["selectedObject"] as IAzManItem != null)
            {
                _AuthItem    = Session["selectedObject"] as IAzManItem;
                _Application = _AuthItem.Application;
                _Store       = _Application.Store;

                _Authorization = _AuthItem.GetAuthorization(_AuthorizationID);
                MemberType memberType = _Authorization.GetMemberInfo(out _DisplayName);
            }
            if (Session["selectedObject"] as IAzManApplicationGroup != null)
            {
                _ApplicationGroup = Session["selectedObject"] as IAzManApplicationGroup;
                _Application      = _ApplicationGroup.Application;
                _Store            = _Application.Store;
            }

            SetAttributes();
            SetToolBar();
            SetListView();

            LoadList();
        }
        private void Form_Load(object sender, EventArgs e)
        {
            _Storage = (IAzManStorage)Session["storage"];

            if (Session["selectedObject"] as IAzManStore != null)
            {
                _Store = Session["selectedObject"] as IAzManStore;
            }
            if (Session["selectedObject"] as IAzManApplication != null)
            {
                _Application = Session["selectedObject"] as IAzManApplication;
                _Store       = _Application.Store;
            }
            if (Session["selectedObject"] as IAzManApplicationGroup != null)
            {
                _ApplicationGroup = Session["selectedObject"] as IAzManApplicationGroup;
                _Application      = _ApplicationGroup.Application;
                _Store            = _Application.Store;
            }

            _Mode = (_ApplicationGroup == null) ? Mode.Create : Mode.Update;

            SetAttributes();
            SetToolBar();

            if (_Mode == Mode.Update)
            {
                LoadRecord();
            }
        }
Exemple #4
0
        private void Form_Load(object sender, EventArgs e)
        {
            _Storage = (IAzManStorage)Session["storage"];

            if (Session["selectedObject"] as IAzManStore != null)
            {
                _Store = Session["selectedObject"] as IAzManStore;
            }
            if (Session["selectedObject"] as IAzManApplication != null)
            {
                _Application = Session["selectedObject"] as IAzManApplication;
                _Store       = _Application.Store;
            }
            if (Session["selectedObject"] as IAzManItem != null)
            {
                _Task        = Session["selectedObject"] as IAzManItem;
                _Application = _Task.Application;
                _Store       = _Application.Store;
            }
            if (Session["selectedObject"] as IAzManApplicationGroup != null)
            {
                _ApplicationGroup = Session["selectedObject"] as IAzManApplicationGroup;
                _Application      = _ApplicationGroup.Application;
                _Store            = _Application.Store;
            }

            _Mode = (_Task == null) ? Mode.Create : Mode.Update;

            SetAttributes();
            LoadTab();
        }
Exemple #5
0
        private void Form_Load(object sender, EventArgs e)
        {
            _Storage = (IAzManStorage)Session["storage"];

            if (Session["selectedObject"] as IAzManStore != null)
            {
                _Store = Session["selectedObject"] as IAzManStore;
            }
            if (Session["selectedObject"] as IAzManApplication != null)
            {
                _Application = Session["selectedObject"] as IAzManApplication;
                _Store       = _Application.Store;
            }
            if (Session["selectedObject"] as IAzManItem != null)
            {
                _AzManItem   = Session["selectedObject"] as IAzManItem;
                _Application = _AzManItem.Application;
                _Store       = _Application.Store;
            }
            if (Session["selectedObject"] as IAzManApplicationGroup != null)
            {
                _ApplicationGroup = Session["selectedObject"] as IAzManApplicationGroup;
                _Application      = _ApplicationGroup.Application;
                _Store            = _Application.Store;
            }

            _Mode = String.IsNullOrEmpty(_AzManItem.BizRuleSource) ? Mode.Create : Mode.Update;

            SetAttributes();
            SetToolBar();

            LoadBizRule();
        }
Exemple #6
0
        private void Form_Load(object sender, EventArgs e)
        {
            _Storage = (IAzManStorage)Session["storage"];

            if (Session["selectedObject"] as IAzManStore != null)
            {
                _Store = this.Session["selectedObject"] as IAzManStore;
            }
            if (Session["selectedObject"] as IAzManStoreGroup != null)
            {
                _StoreGroup = this.Session["selectedObject"] as IAzManStoreGroup;
                _Store      = _StoreGroup.Store;
            }
            //_Store = (IAzManStore)Session["selectedObject"];

            _Mode = (_Store == null) ? Mode.Create : Mode.Update;

            SetAttributes();
            SetToolBar();

            if (_Mode == Mode.Update)
            {
                LoadRecord();
            }
        }
 protected override void Render()
 {
     //Prepare Node
     this.RenderStorageScopeNode();
     //Children
     this.Children.Clear();
     try
     {
         if (this.storage != null)
         {
             try
             {
                 this.storage.OpenConnection();
                 IAzManStore[]         stores = this.storage.GetStores();
                 List <StoreScopeNode> list   = new List <StoreScopeNode>();
                 for (int i = 0; i < stores.Length; i++)
                 {
                     list.Add(new StoreScopeNode(stores[i]));
                 }
                 this.Children.AddRange(list.ToArray());
             }
             catch (SqlException)
             {
                 this.storage = null;
             }
         }
     }
     finally
     {
         if (this.storage != null)
         {
             this.storage.CloseConnection();
         }
     }
 }
Exemple #8
0
 /// <summary>
 /// Writes the info.
 /// </summary>
 /// <param name="storage">The storage.</param>
 /// <param name="message">The message.</param>
 public void WriteInfo(IAzManStorage storage, string message)
 {
     if (storage != null && storage.LogInformations)
     {
         this.WriteEvent(storage, message, EventLogEntryType.Information);
     }
 }
        protected internal void sqlStoreConnectionStringAction_Triggered(object sender, MMC.SyncActionEventArgs e)
        {
            frmStorageConnection frm = new frmStorageConnection();

            frm.dataSource     = this.dataSource;
            frm.initialCatalog = this.initialCatalog;
            frm.security       = this.security;
            frm.otherSettings  = this.otherSettings;
            frm.userId         = this.userId;
            frm.password       = this.password;
            DialogResult dr = this.SnapIn.Console.ShowDialog(frm);

            if (dr == DialogResult.OK)
            {
                this.dataSource     = frm.dataSource;
                this.initialCatalog = frm.initialCatalog;
                this.security       = frm.security;
                this.otherSettings  = frm.otherSettings;
                this.userId         = frm.userId;
                this.password       = frm.password;
                this.storage        = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings));
                this.Render();
                ((NetSqlAzManSnapIn)this.SnapIn).dataSource     = this.dataSource;
                ((NetSqlAzManSnapIn)this.SnapIn).initialCatalog = this.initialCatalog;
                ((NetSqlAzManSnapIn)this.SnapIn).security       = this.security;
                ((NetSqlAzManSnapIn)this.SnapIn).otherSettings  = this.otherSettings;
                ((NetSqlAzManSnapIn)this.SnapIn).userId         = this.userId;
                ((NetSqlAzManSnapIn)this.SnapIn).password       = this.password;
                this.SnapIn.IsModified = true;
            }
        }
Exemple #10
0
 /// <summary>
 /// Writes the error.
 /// </summary>
 /// <param name="storage">The storage.</param>
 /// <param name="message">The message.</param>
 public void WriteError(IAzManStorage storage, string message)
 {
     if (storage != null && storage.LogErrors)
     {
         this.WriteEvent(storage, message, EventLogEntryType.Error);
     }
 }
Exemple #11
0
 /// <summary>
 /// Writes the warning.
 /// </summary>
 /// <param name="storage">The storage.</param>
 /// <param name="message">The message.</param>
 public void WriteWarning(IAzManStorage storage, string message)
 {
     if (storage != null && storage.LogWarnings)
     {
         this.WriteEvent(storage, message, EventLogEntryType.Warning);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     if (this.Session["selectedObject"] as IAzManStore != null)
     {
         this.store = this.Session["selectedObject"] as IAzManStore;
     }
     if (!Page.IsPostBack)
     {
         if (this.store != null)
         {
             this.btnPermissions.Enabled = true;
             this.btnAttributes.Enabled = true;
             this.txtName.Text = this.store.Name;
             this.txtDescription.Text = this.store.Description;
             this.txtName.Focus();
             this.Text = "Store Properties - " + this.store.Name;
             this.Title = this.Text;
             this.Description = "Store Properties";
             if (!this.store.IAmManager)
                 this.txtName.Enabled = this.txtDescription.Enabled = this.btnOk.Enabled = false;
         }
         else
         {
             this.btnPermissions.Enabled = false;
             this.btnAttributes.Enabled = false;
             this.Description = "Create a New Store";
             this.Text = "New Store";
             this.Title = this.Text;
         }
         this.txtName.Focus();
     }
 }
        private void Form_Load(object sender, EventArgs e)
        {
            _Storage = (IAzManStorage)Session["storage"];

            if (Session["selectedObject"] as IAzManStore != null)
            {
                _Store = Session["selectedObject"] as IAzManStore;
            }
            if (Session["selectedObject"] as IAzManApplication != null)
            {
                _Application = Session["selectedObject"] as IAzManApplication;
                _Store       = _Application.Store;
            }
            if (Session["selectedObject"] as IAzManItem != null)
            {
                _AuthItem    = Session["selectedObject"] as IAzManItem;
                _Application = _AuthItem.Application;
                _Store       = _Application.Store;
            }
            if (Session["selectedObject"] as IAzManApplicationGroup != null)
            {
                _ApplicationGroup = Session["selectedObject"] as IAzManApplicationGroup;
                _Application      = _ApplicationGroup.Application;
                _Store            = _Application.Store;
            }

            SetAttributes();
            SetToolBar();

            LoadList();
        }
Exemple #14
0
        public DialogResult ShowDialog(IWin32Window owner, string fileName, object importIntoObject, bool chkUsersAndGroups, bool chkDBUsers, bool chkAuthorizations, SqlAzManMergeOptions mergeOptions)
        {
            this.DialogResult = DialogResult.None;
            this.TopMost      = true;
            this.Show(owner);
            /*Application.DoEvents();*/
            XmlDocument doc = new XmlDocument();

            doc.Load(fileName);
            XmlNode xmlStartNode;

            if (this.checkScopeNodePosition(doc, ref importIntoObject, out xmlStartNode))
            {
                IAzManStorage storage = this.getStorageReference(importIntoObject);
                try
                {
                    storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
                    ((IAzManImport)importIntoObject).ImportChildren(xmlStartNode, chkUsersAndGroups, chkDBUsers, chkAuthorizations, mergeOptions);
                    storage.CommitTransaction();
                    this.Hide();
                    return(this.DialogResult = DialogResult.OK);
                }
                catch
                {
                    storage.RollBackTransaction();
                    this.DialogResult = DialogResult.Cancel;
                    this.Hide();
                    throw;
                }
            }
            else
            {
                return(this.DialogResult = DialogResult.Cancel);
            }
        }
Exemple #15
0
 private void raiseStoreDeleted(IAzManStorage ownerStorage, string storeName)
 {
     if (this.StoreDeleted != null)
     {
         this.StoreDeleted(ownerStorage, storeName);
     }
 }
 void modeAndLoggingAction_Triggered(object sender, MMC.SyncActionEventArgs e)
 {
     try
     {
         frmOptions frm = new frmOptions();
         frm.storage         = this.storage;
         frm.mode            = this.storage.Mode;
         frm.logOnEventLog   = this.storage.LogOnEventLog;
         frm.logOnDb         = this.storage.LogOnDb;
         frm.logErrors       = this.storage.LogErrors;
         frm.logWarnings     = this.storage.LogWarnings;
         frm.logInformations = this.storage.LogInformations;
         DialogResult dr = this.SnapIn.Console.ShowDialog(frm);
         if (dr == DialogResult.OK)
         {
             this.storage.Mode            = frm.mode;
             this.storage.LogOnEventLog   = frm.logOnEventLog;
             this.storage.LogOnDb         = frm.logOnDb;
             this.storage.LogErrors       = frm.logErrors;
             this.storage.LogWarnings     = frm.logWarnings;
             this.storage.LogInformations = frm.logInformations;
             this.storage           = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings));
             this.SnapIn.IsModified = true;
             this.Render();
         }
     }
     catch (Exception ex)
     {
         this.ShowError(ex.Message + "\r\n" + Globalization.MultilanguageResource.GetString("StorageScopeNode_Msg30"), Globalization.MultilanguageResource.GetString("StorageScopeNode_Tit30"));
     }
 }
Exemple #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     if (this.Session["selectedObject"] as IAzManStore != null)
     {
         this.store = this.Session["selectedObject"] as IAzManStore;
     }
     if (!Page.IsPostBack)
     {
         if (this.store != null)
         {
             this.btnPermissions.Enabled = true;
             this.btnAttributes.Enabled  = true;
             this.txtName.Text           = this.store.Name;
             this.txtDescription.Text    = this.store.Description;
             this.txtName.Focus();
             this.Text        = "Store Properties - " + this.store.Name;
             this.Title       = this.Text;
             this.Description = "Store Properties";
             if (!this.store.IAmManager)
             {
                 this.txtName.Enabled = this.txtDescription.Enabled = this.btnOk.Enabled = false;
             }
         }
         else
         {
             this.btnPermissions.Enabled = false;
             this.btnAttributes.Enabled  = false;
             this.Description            = "Create a New Store";
             this.Text  = "New Store";
             this.Title = this.Text;
         }
         this.txtName.Focus();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.storage = this.Session["storage"] as IAzManStorage;
            if (this.Session["storeGroup"] as IAzManStoreGroup!=null)
                this.store = ((IAzManStoreGroup)this.Session["storeGroup"]).Store;
            if (this.Session["application"] as IAzManApplication != null)
            {
                this.application = (IAzManApplication)this.Session["application"];
                this.store = this.application.Store;
            }
            this.Text = "DB Users List";
            this.Description = this.Text;
            this.Title = this.Text;
            if (!Page.IsPostBack)
            {
                //Filtering
                this.cmbFieldName.Items.Clear();
                this.cmbOperator.Items.Clear();
                this.cmbOperator.Items.AddRange(
                    new[] {
                    new ListItem("Is"),
                    new ListItem("Is not"),
                    new ListItem("Starts with"),
                    new ListItem("Ends with"),
                    new ListItem("Does not start with"),
                    new ListItem("Does not end with"),
                    new ListItem("Contains"),
                    new ListItem("Does not contain")
                });
                this.cmbOperator.SelectedIndex = 0;
                this.txtFieldValue.Text = String.Empty;

                this.RefreshDBUsersList();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     this.menuItem = Request["MenuItem"];
     this.Text = ".NET Sql Authorization Manager Web Console";
     this.Description = this.Text;
     this.Title = this.Text;
     //this.showWaitPanelOnSubmit(this.pnlWait, this.pnlXXX);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage     = this.Session["storage"] as IAzManStorage;
     this.menuItem    = Request["MenuItem"];
     this.Text        = ".NET Sql Authorization Manager Export";
     this.Description = this.menuItem;
     this.Title       = this.Text;
     this.showWaitPanelOnSubmit(this.pnlWait, this.pnlExport);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     this.menuItem = Request["MenuItem"];
     this.Text = "Import Store from Microsoft Authorization Manager (AzMan)";
     this.Description = this.Text;
     this.Title = this.Text;
     this.rbtStoreFile_CheckedChanged(this, EventArgs.Empty);
     this.showWaitPanelOnSubmit(this.pnlWait, this.pnlImportFromAzMan);
 }
Exemple #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage     = this.Session["storage"] as IAzManStorage;
     this.menuItem    = Request["MenuItem"];
     this.Text        = "Import Store from Microsoft Authorization Manager (AzMan)";
     this.Description = this.Text;
     this.Title       = this.Text;
     this.rbtStoreFile_CheckedChanged(this, EventArgs.Empty);
     this.showWaitPanelOnSubmit(this.pnlWait, this.pnlImportFromAzMan);
 }
Exemple #23
0
 internal SqlAzManStore(NetSqlAzManStorageDataContext db, IAzManStorage storage, int storeId, string name, string description, byte netsqlazmanFixedServerRole, SqlAzManENS ens)
 {
     this.db          = db;
     this.storage     = storage;
     this.storeId     = storeId;
     this.name        = name;
     this.description = description;
     this.currentSid  = new SqlAzManSID(((System.Threading.Thread.CurrentPrincipal.Identity as WindowsIdentity) ?? WindowsIdentity.GetCurrent()).User).BinaryValue;
     this.netsqlazmanFixedServerRole = netsqlazmanFixedServerRole;
     this.ens = ens;
 }
Exemple #24
0
 /// <summary>
 /// Constructor that builds a hierarchical menu based upon authorization right of the user
 /// in the given store.
 /// </summary>
 /// <param name="store">String that represents the store that the menu is built upon.</param>
 /// <param name="user">User name.</param>
 /// <param name="baseUrl">Base url for generated menu urls.</param>
 /// <param name="menuUrl">Base url for menu resolved.</param>
 /// <param name="displayFullMenu">Whether to display full menu</param>
 public PemsMenu(string store, string user, string baseUrl, string menuUrl, bool displayFullMenu)
 {
     _displayFullMenu = displayFullMenu;
     _storage         = new SqlAzManStorage(connectionString: ConfigurationManager.ConnectionStrings[Constants.Security.RbacConnectionStringName].ConnectionString);
     _dbUser          = _storage.GetDBUser(user);
     _baseUrl         = baseUrl;
     _store           = store;
     _menuUrl         = menuUrl;
     // Create the menu
     GetMenu();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     this.showCloseOnly();
     if (!Page.IsPostBack)
     {
         SqlAudit.SqlAuditSettings settings = new SqlAudit.SqlAuditSettings();
         this.Description = "SqlAudit ver. " + settings.GetType().Assembly.GetName().Version.ToString();
     }
     this.Text = "Auditing";
     this.showWaitPanelOnSubmit(this.pnlWait, this.pnlAudit);
 }
Exemple #26
0
        private UserPermissionCache(IAzManStorage storage, string storeName, string applicationName, bool retrieveAttributes, params KeyValuePair <string, object>[] contextParameters)
        {
            this.storage = storage;
            IAzManStore iStore = this.storage.GetStore(storeName);

            this.storeName = storeName;
            IAzManApplication iApp = iStore.GetApplication(applicationName);

            this.applicationName    = applicationName;
            this.contextParameters  = contextParameters;
            this.retrieveAttributes = retrieveAttributes;
        }
Exemple #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage     = this.Session["storage"] as IAzManStorage;
     this.store       = this.Session["selectedObject"] as IAzManStore;
     this.Text        = String.Format("Store Attributes: {0}", this.store.Name);
     this.Description = this.Text;
     this.Title       = this.Text;
     if (!Page.IsPostBack)
     {
         this.bindGridView();
     }
 }
Exemple #28
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     this.showCloseOnly();
     if (!Page.IsPostBack)
     {
         SqlAudit.SqlAuditSettings settings = new SqlAudit.SqlAuditSettings();
         this.Description = "SqlAudit ver. " + settings.GetType().Assembly.GetName().Version.ToString();
     }
     this.Text = "Auditing";
     this.showWaitPanelOnSubmit(this.pnlWait, this.pnlAudit);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage     = this.Session["storage"] as IAzManStorage;
     this.store       = this.Session["selectedObject"] as IAzManStore;
     this.Text        = String.Format("Store Permissions: {0}", this.store.Name);
     this.Title       = this.Text;
     this.Description = "Store Permissions";
     if (!Page.IsPostBack)
     {
         this.RefreshStorePermissions();
     }
 }
        private void Form_Load(object sender, EventArgs e)
        {
            _Storage = (IAzManStorage)Session["storage"];

            if (Session["selectedObject"] as IAzManStore != null)
            {
                _Store = this.Session["selectedObject"] as IAzManStore;
            }

            SetAttributes();
            SetToolBar();
            LoadHierarchyTree();
        }
Exemple #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserPermissionCache"/> class.
 /// </summary>
 /// <param name="storage">The storage.</param>
 /// <param name="storeName">Name of the store.</param>
 /// <param name="applicationName">Name of the application.</param>
 /// <param name="windowsIdentity">The windows identity.</param>
 /// <param name="retrieveAttributes">if set to <c>true</c> [retrieve attributes].</param>
 /// <param name="multiThreadBuild">if set to <c>true</c> [multi thread build].</param>
 /// <param name="contextParameters">The context parameters.</param>
 public UserPermissionCache(IAzManStorage storage, string storeName, string applicationName, WindowsIdentity windowsIdentity, bool retrieveAttributes, bool multiThreadBuild, params KeyValuePair <string, object>[] contextParameters)
     : this(storage, storeName, applicationName, retrieveAttributes, contextParameters)
 {
     this.windowsIdentity = windowsIdentity;
     if (multiThreadBuild)
     {
         this.buildApplicationCacheMultiThread();
     }
     else
     {
         this.buildApplicationCache();
     }
 }
Exemple #32
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage          = this.Session["storage"] as IAzManStorage;
     this.applicationGroup = this.Session["applicationGroup"] as IAzManApplicationGroup;
     this.application      = this.Session["application"] as IAzManApplication;
     this.Text             = "Application Groups List";
     this.Description      = this.Text;
     this.Title            = this.Text;
     if (!Page.IsPostBack)
     {
         this.RefreshApplicationList();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     this.application = this.Session["selectedObject"] as IAzManApplication;
     if (!Page.IsPostBack)
     {
         this.txtName.Focus();
         this.Text = "New Application Group";
         this.Title = this.Text;
         this.Description = this.Text;
         this.txtName.Focus();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     this.storeGroup = this.Session["storeGroup"] as IAzManStoreGroup;
     this.store = this.Session["store"] as IAzManStore;
     this.Text = "Store Groups List";
     this.Description = this.Text;
     this.Title = this.Text;
     if (!Page.IsPostBack)
     {
         this.RefreshStoreList();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage     = this.Session["storage"] as IAzManStorage;
     this.application = this.Session["selectedObject"] as IAzManApplication;
     if (!Page.IsPostBack)
     {
         this.txtName.Focus();
         this.Text        = "New Application Group";
         this.Title       = this.Text;
         this.Description = this.Text;
         this.txtName.Focus();
     }
 }
Exemple #36
0
        private void UpdateRootNode()
        {
            StorageScopeNode ssn = ((StorageScopeNode)this.RootNode);

            do
            {
                try
                {
                    ssn.storage        = this.storage;
                    ssn.dataSource     = this.dataSource;
                    ssn.initialCatalog = this.initialCatalog;
                    ssn.security       = this.security;
                    ssn.otherSettings  = this.otherSettings;
                    ssn.userId         = this.userId;
                    ssn.password       = this.password;
                    ssn.internalRender();
                }
                catch (SqlException)
                {
                    this.storage = null;
                    ssn.storage  = null;
                }
                if (ssn.storage == null)
                {
                    if (this.splash != null && this.splash.Visible)
                    {
                        System.Threading.Thread.Sleep(1000);
                        this.splash.Close();
                        this.splash.Dispose();
                        Application.DoEvents();
                    }
                    frmStorageConnection frm = new frmStorageConnection();
                    DialogResult         dr  = this.Console.ShowDialog(frm);
                    if (dr == DialogResult.OK)
                    {
                        this.dataSource     = frm.dataSource;
                        this.initialCatalog = frm.initialCatalog;
                        this.security       = frm.security;
                        this.otherSettings  = frm.otherSettings;
                        this.userId         = frm.userId;
                        this.password       = frm.password;
                        this.storage        = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings));
                    }
                    else
                    {
                        return;
                    }
                }
            } while (ssn.storage == null);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage     = this.Session["storage"] as IAzManStorage;
     this.application = this.Session["selectedObject"] as IAzManApplication;
     this.Text        = "Generate CheckAccessHelper class";
     this.Description = this.Text;
     this.Title       = this.Text;
     if (!Page.IsPostBack)
     {
         this.btnCopy.Attributes["onclick"] = String.Format("javascript: copyToClipBoard('{0}');", this.txtSourceCode.UniqueID);
         this.txtNamespace.Text             = this.TransformToVariable("", this.application.Name, false) + ".Security";
         this.btnGenerate_Click(this, EventArgs.Empty);
         this.txtClassName.Focus();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     this.application = this.Session["selectedObject"] as IAzManApplication;
     this.Text = "Generate CheckAccessHelper class";
     this.Description = this.Text;
     this.Title = this.Text;
     if (!Page.IsPostBack)
     {
         this.btnCopy.Attributes["onclick"] = String.Format("javascript: copyToClipBoard('{0}');", this.txtSourceCode.UniqueID);
         this.txtNamespace.Text = this.TransformToVariable("", this.application.Name, false) + ".Security";
         this.btnGenerate_Click(this, EventArgs.Empty);
         this.txtClassName.Focus();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.storage = this.Session["storage"] as IAzManStorage;
            if (this.Session["selectedObject"] as IAzManStore!=null)
            {
                IAzManStore store = ((IAzManStore)this.Session["selectedObject"]);
                this.applications = new IAzManApplication[store.Applications.Count];
                store.Applications.Values.CopyTo(this.applications, 0);
            }
            else
            {

                this.applications = new IAzManApplication[] { (IAzManApplication)this.Session["selectedObject"] };
            }

            this.Text = "Effective Permissions";
            this.Description = String.Empty;
            this.Title = this.Text;
            this.reportMode(true);

            //Build Storage Cache
            this.storageCache = new StorageCache(this.applications[0].Store.Storage.ConnectionString);
            this.storageCache.BuildStorageCache(this.applications[0].Store.Name);
            //Get All Domain Users
            this.userUPNs = NetSqlAzMan.DirectoryServices.DirectoryServicesUtils.GetAllDomainUsers();

            string nowaitpanel = this.Request["nowaitpanel"];

            if (String.IsNullOrEmpty(nowaitpanel))
            {
                if (!Page.IsPostBack)
                {
                    this.showWaitPanelNow(this.pnlWait, this.itemsHierachyPanel);
                    this.RegisterEndClientScript("window.location='rptEffectivePermissions.aspx?nowaitpanel=true';");
                }
            }
            else if (nowaitpanel == "true")
            {
                this.itemsHierachyPanel.Visible = true;
                this.pnlWait.Visible = false;
                if (!Page.IsPostBack)
                {
                    this.buildApplicationsTreeView();
                    this.itemsHierarchyTreeView.ExpandAll();
                }
            }
        }
 public NetSqlAzManSnapIn()
 {
     if (NetSqlAzMan.SnapIn.Utilities.ConsoleUtilities.commandLineArgumentOn("DebugMode"))
         MessageBox.Show("NetSqlAzMan Debug Mode. Attach to the process now.", "Debug Mode", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
     this.loadingCustomData = false;
     this.Tag = this;
     ImageIndexes.LoadImages(this.SmallImages, this.LargeImages);
     this.dataSource = String.Empty;
     this.initialCatalog = String.Empty;
     this.security = String.Empty;
     this.userId = String.Empty;
     this.password = String.Empty;
     this.otherSettings = String.Empty;
     this.storage = null;
     //Catch Console Errors to Application Event Log
     Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
 }
 protected void Page_Init(object sender, EventArgs e)
 {
     this.setImage("Options_32x32.gif");
     this.setOkHandler(new EventHandler(this.btnOk_Click));
     this.storage = this.Session["storage"] as IAzManStorage;
     this.rbAdministrator.Checked = (this.storage.Mode == NetSqlAzManMode.Administrator);
     this.rbDeveloper.Checked = (this.storage.Mode == NetSqlAzManMode.Developer);
     this.chkLogOnEventLog.Checked = this.storage.LogOnEventLog;
     this.chkLogOnDb.Checked = this.storage.LogOnDb;
     this.chkErrors.Checked = this.storage.LogErrors;
     this.chkWarnings.Checked = this.storage.LogWarnings;
     this.chkInformations.Checked = this.storage.LogInformations;
     this.chkLogType_CheckedChanged(this, EventArgs.Empty);
     this.Text = ".NET Sql Authorization Manager options";
     this.Description = "Manage .NET Sql Authorization Manager options";
     if (!this.storage.IAmAdmin)
         this.rbDeveloper.Enabled = this.rbAdministrator.Enabled = this.chkLogOnEventLog.Enabled = this.chkLogOnDb.Enabled = this.chkErrors.Enabled = this.chkWarnings.Enabled = this.chkInformations.Enabled = this.btnOk.Enabled = false;
 }
        public StorageScopeNode(
            string dataSource,
            string initialCatalog,
            string security,
            string userId,
            string password,
            string otherSettings,
            IAzManStorage storage)
        {
            try
            {
                this.dataSource = dataSource;
                this.initialCatalog = initialCatalog;
                this.security = security;
                this.userId = userId;
                this.password = password;
                this.otherSettings = otherSettings;
                this.storage = storage;

                //Async check for Tdo update
                if (!NetSqlAzMan.SnapIn.Utilities.ConsoleUtilities.commandLineArgumentOn("NoCheckForUpdate"))
                    System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(this.CheckForUpdateSync));
                //System.Threading.Thread asyncCheckForUpdate = new System.Threading.Thread(new System.Threading.ThreadStart(this.CheckForUpdateSync));
                //asyncCheckForUpdate.Start();
                this.RenderStorageScopeNode();
            }
            catch (Exception ex)
            {
                // set up the update authorizationType pane when scope node selected
                MMC.MessageViewDescription mvd = new MMC.MessageViewDescription();
                mvd.DisplayName = Globalization.MultilanguageResource.GetString("MMC_Msg20");
                mvd.BodyText = ex.Message;
                mvd.IconId = MMC.MessageViewIcon.Error;

                // attach the view and set it as the default to show
                this.ViewDescriptions.Clear();
                this.ViewDescriptions.Add(mvd);
                this.ViewDescriptions.DefaultIndex = 0;
                new NetSqlAzMan.Logging.LoggingUtility().WriteError(this.storage, ex.Message);
            }
        }
Exemple #43
0
 public DialogResult ShowDialog(MMC.SyncActionEventArgs e, string fileName, IAzManExport[] objectsToExport, bool includeSecurityObjects, bool includeDBUsers, bool includeAuthorizations, IAzManStorage storage)
 {
     this.storage = storage;
     XmlWriter xw=null;
     try
     {
         this.Show();
         this.Activate();
         this.Focus();
         /*Application.DoEvents();*/
         if (e!=null)
             e.Status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("frmExport_Msg10"));
         xw = XmlWriter.Create(fileName);
         this.BeginExport(xw);
         foreach (IAzManExport objectToExport in objectsToExport)
         {
             objectToExport.Export(xw, includeSecurityObjects, includeDBUsers, includeAuthorizations, objectToExport);
             /*Application.DoEvents();*/
         }
         this.EndExport(xw);
         if (e != null)
             e.Status.Complete(Globalization.MultilanguageResource.GetString("frmExport_Msg20"), true);
         return this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("frmExport_Msg30"));
         e.Status.Complete(Globalization.MultilanguageResource.GetString("frmExport_Msg20"), false);
         return this.DialogResult = DialogResult.Cancel;
     }
     finally
     {
         if (xw != null)
         {
             xw.Flush();
             xw.Close();
         }
         this.Hide();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.storage = this.Session["storage"] as IAzManStorage;
            if (this.Session["selectedObject"] as IAzManStore != null)
            {
                IAzManStore store = ((IAzManStore)this.Session["selectedObject"]);
                this.applications = new IAzManApplication[store.Applications.Count];
                store.Applications.Values.CopyTo(this.applications, 0);
            }
            else
            {

                this.applications = new IAzManApplication[] { (IAzManApplication)this.Session["selectedObject"] };
            }
            this.Text = "Items Hierarchy";
            this.Description = String.Empty;
            this.Title = this.Text;
            this.reportMode(true);
            string nowaitpanel = this.Request["nowaitpanel"];
            if (String.IsNullOrEmpty(nowaitpanel))
            {
                if (!Page.IsPostBack)
                {
                    this.showWaitPanelNow(this.pnlWait, this.itemsHierachyPanel);
                    this.RegisterEndClientScript("window.location='rptItemsHierarchy.aspx?nowaitpanel=true'");
                }
            }
            else if (nowaitpanel == "true")
            {
                this.itemsHierachyPanel.Visible = true;
                this.pnlWait.Visible = false;
                if (!Page.IsPostBack)
                {
                    this.buildApplicationsTreeView();
                    this.itemsHierarchyTreeView.ExpandAll();
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserPermissionCache"/> class.
 /// </summary>
 /// <param name="storage">The storage.</param>
 /// <param name="storeName">Name of the store.</param>
 /// <param name="applicationName">Name of the application.</param>
 /// <param name="windowsIdentity">The windows identity.</param>
 /// <param name="retrieveAttributes">if set to <c>true</c> [retrieve attributes].</param>
 /// <param name="multiThreadBuild">if set to <c>true</c> [multi thread build].</param>
 /// <param name="contextParameters">The context parameters.</param>
 public UserPermissionCache(IAzManStorage storage, string storeName, string applicationName, WindowsIdentity windowsIdentity, bool retrieveAttributes, bool multiThreadBuild, params KeyValuePair<string, object>[] contextParameters)
     : this(storage, storeName, applicationName, retrieveAttributes, contextParameters)
 {
     this.windowsIdentity = windowsIdentity;
     if (multiThreadBuild)
         this.buildApplicationCacheMultiThread();
     else
         this.buildApplicationCache();
 }
 private UserPermissionCache(IAzManStorage storage, string storeName, string applicationName, bool retrieveAttributes, params KeyValuePair<string, object>[] contextParameters)
 {
     this.storage = storage;
     IAzManStore iStore = this.storage.GetStore(storeName);
     this.storeName = storeName;
     IAzManApplication iApp = iStore.GetApplication(applicationName);
     this.applicationName = applicationName;
     this.contextParameters = contextParameters;
     this.retrieveAttributes = retrieveAttributes;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     this.store = this.Session["selectedObject"] as IAzManStore;
     this.Text = String.Format("Store Attributes: {0}", this.store.Name);
     this.Description = this.Text;
     this.Title = this.Text;
     if (!Page.IsPostBack)
     {
         this.bindGridView();
     }
 }
 void modeAndLoggingAction_Triggered(object sender, MMC.SyncActionEventArgs e)
 {
     try
     {
         frmOptions frm = new frmOptions();
         frm.storage = this.storage;
         frm.mode = this.storage.Mode;
         frm.logOnEventLog = this.storage.LogOnEventLog;
         frm.logOnDb = this.storage.LogOnDb;
         frm.logErrors = this.storage.LogErrors;
         frm.logWarnings = this.storage.LogWarnings;
         frm.logInformations = this.storage.LogInformations;
         DialogResult dr = this.SnapIn.Console.ShowDialog(frm);
         if (dr == DialogResult.OK)
         {
             this.storage.Mode = frm.mode;
             this.storage.LogOnEventLog = frm.logOnEventLog;
             this.storage.LogOnDb = frm.logOnDb;
             this.storage.LogErrors = frm.logErrors;
             this.storage.LogWarnings = frm.logWarnings;
             this.storage.LogInformations = frm.logInformations;
             this.storage = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings));
             this.SnapIn.IsModified = true;
             this.Render();
         }
     }
     catch (Exception ex)
     {
         this.ShowError(ex.Message + "\r\n" + Globalization.MultilanguageResource.GetString("StorageScopeNode_Msg30"), Globalization.MultilanguageResource.GetString("StorageScopeNode_Tit30"));
     }
 }
Exemple #49
0
 public UserAccountService(IUnitOfWork unitOfWork, IAzManStorage store, NetSqlAzManRoleProvider provider)
 {
     this._unitOfWork = unitOfWork;
     this._store = store;
     this._provider = provider;
 }
 protected internal void sqlStoreConnectionStringAction_Triggered(object sender, MMC.SyncActionEventArgs e)
 {
     frmStorageConnection frm = new frmStorageConnection();
     frm.dataSource = this.dataSource;
     frm.initialCatalog = this.initialCatalog;
     frm.security = this.security;
     frm.otherSettings = this.otherSettings;
     frm.userId = this.userId;
     frm.password = this.password;
     DialogResult dr = this.SnapIn.Console.ShowDialog(frm);
     if (dr == DialogResult.OK)
     {
         this.dataSource = frm.dataSource;
         this.initialCatalog = frm.initialCatalog;
         this.security = frm.security;
         this.otherSettings = frm.otherSettings;
         this.userId = frm.userId;
         this.password = frm.password;
         this.storage = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings));
         this.Render();
         ((NetSqlAzManSnapIn)this.SnapIn).dataSource = this.dataSource;
         ((NetSqlAzManSnapIn)this.SnapIn).initialCatalog = this.initialCatalog;
         ((NetSqlAzManSnapIn)this.SnapIn).security = this.security;
         ((NetSqlAzManSnapIn)this.SnapIn).otherSettings = this.otherSettings;
         ((NetSqlAzManSnapIn)this.SnapIn).userId = this.userId;
         ((NetSqlAzManSnapIn)this.SnapIn).password = this.password;
         this.SnapIn.IsModified = true;
     }
 }
 /// <summary>
 /// Writes the event.
 /// </summary>
 /// <param name="storage">The storage.</param>
 /// <param name="message">The message.</param>
 /// <param name="type">The type.</param>
 private void WriteEvent(IAzManStorage storage, string message, EventLogEntryType type)
 {
     try
     {
         SqlAzManStorage typedStorage = storage as SqlAzManStorage;
         bool logOnDb = false;
         bool logOnEventLog = true;
         string connectionString = String.Empty;
         Guid instanceGuid = Guid.Empty;
         Guid transactionGuid = Guid.Empty;
         int operationCounter = 0;
         DateTime now = DateTime.Now;
         if (typedStorage != null)
         {
             logOnDb = typedStorage.LogOnDb;
             logOnEventLog = typedStorage.LogOnEventLog;
             connectionString = typedStorage.db.Connection.ConnectionString;
             instanceGuid = typedStorage.instanceGuid;
             transactionGuid = typedStorage.transactionGuid;
             operationCounter = ++typedStorage.operationCounter;
         }
         string originalMessage = message;
         if (logOnDb)
         {
             string ENSType = "User Log";
             if (message.StartsWith("ENS Event: ", StringComparison.CurrentCultureIgnoreCase))
             {
                 ENSType = message.Substring(message.IndexOf("ENS Event: ") + 11);
                 ENSType = ENSType.Substring(0, ENSType.IndexOf("\r\n"));
                 message = message.Substring(message.IndexOf("\r\n") + 2);
                 message = message.TrimStart('\r').TrimStart('\n');
             }
             while (message.IndexOf("\r\n\r\n") != -1)
             {
                 message = message.Replace("\r\n\r\n", "\r\n");
             }
             message = message.Replace("\r\n", ";");
             string logType;
             switch (type)
             {
                 case EventLogEntryType.Error: logType = "E"; break;
                 case EventLogEntryType.Warning: logType = "W"; break;
                 default:
                     logType = "I"; break;
             }
             NTAccount nta = new NTAccount(((System.Threading.Thread.CurrentPrincipal.Identity as WindowsIdentity) ?? WindowsIdentity.GetCurrent()).Name);
             SecurityIdentifier sid = (SecurityIdentifier)nta.Translate(typeof(SecurityIdentifier));
             string winIdentity = String.Format("{0} ({1}", nta.Value, sid.Value);
             NetSqlAzManStorageDataContext db = new NetSqlAzManStorageDataContext(connectionString);
             NetSqlAzMan.LINQ.LogTable log = new LogTable();
             log.LogDateTime = now;
             log.WindowsIdentity = winIdentity;
             log.MachineName = Environment.MachineName;
             log.InstanceGuid = instanceGuid;
             log.TransactionGuid = transactionGuid == Guid.Empty ? null : new Guid?();
             log.OperationCounter = operationCounter;
             log.ENSType = ENSType;
             log.ENSDescription = message;
             log.LogType = logType;
             db.LogTables.InsertOnSubmit(log);
             db.SubmitChanges();
         }
         if (logOnEventLog)
         {
             if (!EventLog.SourceExists(LoggingUtility.EVENTSOURCE))
             {
                 EventLog.CreateEventSource(LoggingUtility.EVENTSOURCE, "Application");
             }
             originalMessage += String.Format("\r\nInstance Guid: {0}\r\nTransaction Guid: {1}\r\nOperation Counter: {2}", instanceGuid.ToString(), transactionGuid.ToString(), operationCounter);
             EventLog.WriteEntry(LoggingUtility.EVENTSOURCE, originalMessage, type);
         }
     }
     catch
     {
         //Ignore if error occur during logging
     }
 }
 /// <summary>
 /// Load in any saved data
 /// </summary>
 /// <param name="status">asynchronous status for updating the console</param>
 /// <param name="persistenceData">binary data stored in the console file</param>
 protected override void OnLoadCustomData(MMC.AsyncStatus status, byte[] persistenceData)
 {
     try
     {
         this.loadingCustomData = true;
         /*Application.DoEvents();*/
         base.OnLoadCustomData(status, persistenceData);
         string allSettings = Encoding.Unicode.GetString(persistenceData);
         string connectionSettingsString = allSettings.Substring(0, allSettings.LastIndexOf('\n') + 1);
         string savedLanguage = "en";
         if (allSettings.Split('\n').Length >= 7)
         {
             if (!String.IsNullOrEmpty(allSettings.Split('\n')[6]))
             {
                 savedLanguage = allSettings.Split('\n')[6];
             }
         }
         if (!String.IsNullOrEmpty(savedLanguage))
         {
             Globalization.MultilanguageResource.SetCulture(Globalization.MultilanguageResource.cultureName(savedLanguage));
         }
         // saved name? then set snap-in to the name
         if (string.IsNullOrEmpty(connectionSettingsString) || connectionSettingsString == new String('\n', 6))
         {
             if (this.splash != null && this.splash.Visible)
             {
                 new System.Threading.Thread(new System.Threading.ThreadStart(
                     delegate()
                     {
                         System.Threading.Thread.Sleep(1500);
                         this.splash.Close();
                         this.splash.Dispose();
                         Application.DoEvents();
                         this.splash = null;
                     })).Start();
             }
             frmStorageConnection frm = new frmStorageConnection();
             DialogResult dr = this.Console.ShowDialog(frm);
             if (dr == DialogResult.OK)
             {
                 this.dataSource = frm.dataSource;
                 this.initialCatalog = frm.initialCatalog;
                 this.security = frm.security;
                 this.otherSettings = frm.otherSettings;
                 this.userId = frm.userId;
                 this.password = frm.password;
                 this.storage = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings));
                 this.UpdateRootNode();
             }
             else
             {
                 this.storage = null;
             }
         }
         else
         {
             try
             {
                 this.dataSource = connectionSettingsString.Split('\n')[0];
                 this.initialCatalog = connectionSettingsString.Split('\n')[1];
                 this.security = connectionSettingsString.Split('\n')[2];
                 this.otherSettings = connectionSettingsString.Split('\n')[3];
                 this.userId = connectionSettingsString.Split('\n')[4];
                 this.password = connectionSettingsString.Split('\n')[5];
                 this.storage = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings));
                 this.UpdateRootNode();
             }
             catch (SqlException)
             {
                 frmStorageConnection frm = new frmStorageConnection();
                 DialogResult dr = this.Console.ShowDialog(frm);
                 if (dr == DialogResult.OK)
                 {
                     this.dataSource = frm.dataSource;
                     this.initialCatalog = frm.initialCatalog;
                     this.security = frm.security;
                     this.otherSettings = frm.otherSettings;
                     this.userId = frm.userId;
                     this.password = frm.password;
                     this.storage = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings));
                     this.UpdateRootNode();
                 }
                 else
                 {
                     this.storage = null;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         this.ShowError(String.Format(Globalization.MultilanguageResource.GetString("MMC_Msg30"), ex.Message), Globalization.MultilanguageResource.GetString("MMC_Tit30"));
     }
     finally
     {
         if (this.splash != null && this.splash.Visible)
         {
             new System.Threading.Thread(new System.Threading.ThreadStart(
                 delegate()
                 {
                     System.Threading.Thread.Sleep(2500);
                     this.splash.Close();
                     this.splash.Dispose();
                     Application.DoEvents();
                 })).Start();
         }
     }
 }
 /// <summary>
 /// Writes the info.
 /// </summary>
 /// <param name="storage">The storage.</param>
 /// <param name="message">The message.</param>
 public void WriteInfo(IAzManStorage storage, string message)
 {
     if (storage != null && storage.LogInformations)
         this.WriteEvent(storage, message, EventLogEntryType.Information);
 }
 /// <summary>
 /// Writes the warning.
 /// </summary>
 /// <param name="storage">The storage.</param>
 /// <param name="message">The message.</param>
 public void WriteWarning(IAzManStorage storage, string message)
 {
     if (storage != null && storage.LogWarnings)
         this.WriteEvent(storage, message, EventLogEntryType.Warning);
 }
Exemple #55
0
 /// <summary>
 /// Retrive a complete Authorization for the current user and populate the string array
 /// from .NetSqlAzMan store 
 /// </summary>
 /// <param name="userName">User name identifying the current user</param>
 /// <returns>Array of strings containing all of the permissions from .NetSqlAzMan store</returns>
 private bool CheckAccess(IAzManDBUser dbUser, string app, string role, IAzManStorage storage)
 {
     var result = false;
     //IAzManDBUser dbUser = storage.GetDBUser(dbUserName);
     AuthorizationType auth = storage.CheckAccess("CATS", app, role, dbUser, DateTime.Now, false);
     switch (auth)
     {
         case AuthorizationType.AllowWithDelegation:
         case AuthorizationType.Allow:
             result = true;
             break;
         case AuthorizationType.Neutral:
         case AuthorizationType.Deny:
             result = false;
             break;
     }
     return result;
 }
 protected override void Render()
 {
     //Prepare Node
     this.RenderStorageScopeNode();
     //Children
     this.Children.Clear();
     try
     {
         if (this.storage != null)
         {
             try
             {
                 this.storage.OpenConnection();
                 IAzManStore[] stores = this.storage.GetStores();
                 List<StoreScopeNode> list = new List<StoreScopeNode>();
                 for (int i = 0; i < stores.Length; i++)
                 {
                     list.Add(new StoreScopeNode(stores[i]));
                 }
                 this.Children.AddRange(list.ToArray());
             }
             catch (SqlException)
             {
                 this.storage = null;
             }
         }
     }
     finally
     {
         if (this.storage != null)
             this.storage.CloseConnection();
     }
 }
 private void UpdateRootNode()
 {
     StorageScopeNode ssn = ((StorageScopeNode)this.RootNode);
     do
     {
         try
         {
             ssn.storage = this.storage;
             ssn.dataSource = this.dataSource;
             ssn.initialCatalog = this.initialCatalog;
             ssn.security = this.security;
             ssn.otherSettings = this.otherSettings;
             ssn.userId = this.userId;
             ssn.password = this.password;
             ssn.internalRender();
         }
         catch (SqlException)
         {
             this.storage = null;
             ssn.storage = null;
         }
         if (ssn.storage == null)
         {
             if (this.splash != null && this.splash.Visible)
             {
                 System.Threading.Thread.Sleep(1000);
                 this.splash.Close();
                 this.splash.Dispose();
                 Application.DoEvents();
             }
             frmStorageConnection frm = new frmStorageConnection();
             DialogResult dr = this.Console.ShowDialog(frm);
             if (dr == DialogResult.OK)
             {
                 this.dataSource = frm.dataSource;
                 this.initialCatalog = frm.initialCatalog;
                 this.security = frm.security;
                 this.otherSettings = frm.otherSettings;
                 this.userId = frm.userId;
                 this.password = frm.password;
                 this.storage = new SqlAzManStorage(frmStorageConnection.ConstructConnectionString(this.dataSource, this.initialCatalog, !(this.security == "Sql"), this.userId, this.password, this.otherSettings));
             }
             else
             {
                 return;
             }
         }
     } while (ssn.storage == null);
 }
 /// <summary>
 /// Adds the IAzManStorage publisher.
 /// </summary>
 /// <param name="publisher">The publisher.</param>
 internal void AddPublisher(IAzManStorage publisher)
 {
     publisher.StoreOpened += new StoreOpenedDelegate(delegate(IAzManStore store) { if (this.StoreOpened != null) this.StoreOpened(store); });
     publisher.StoreCreated += new StoreCreatedDelegate(delegate(IAzManStore storeCreated) { if (this.StoreCreated != null) this.StoreCreated(storeCreated); });
     publisher.TransactionBeginned += new TransactionBeginnedDelegate(delegate() { if (this.TransactionBeginned != null) this.TransactionBeginned(); });
     publisher.TransactionTerminated += new TransactionTerminatedDelegate(delegate(bool success) { if (this.TransactionTerminated != null) this.TransactionTerminated(success); });
     publisher.NetSqlAzManModeChanged += new NetSqlAzManModeChangeDelegate(delegate(NetSqlAzManMode oldMode, NetSqlAzManMode newMode) { if (this.NetSqlAzManModeChanged != null) this.NetSqlAzManModeChanged(oldMode, newMode); });
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.storage = this.Session["storage"] as IAzManStorage;
     this.application = this.Session["selectedObject"] as IAzManApplication;
     this.Text = String.Format("Application Permissions: {0}", this.application.Name);
     this.Title = this.Text;
     this.Description = "Application Permissions";
     if (!Page.IsPostBack)
         this.RefreshApplicationPermissions();
 }
 public AuthorizeUserAttribute()
 {
     connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SecurityContext"].ConnectionString;
     AzManStore = new NetSqlAzMan.SqlAzManStorage(connectionString);
 }