private void btnOk_Click(object sender, EventArgs e) { try { this.HourGlass(true); //Create if (this.application == null) { this.application = this.store.CreateApplication(this.txtName.Text, this.txtDescription.Text); this.DialogResult = DialogResult.OK; } else { this.application.Store.Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted); this.application.Rename(this.txtName.Text.Trim()); this.application.Update(this.txtDescription.Text.Trim()); this.application.Store.Storage.CommitTransaction(); this.DialogResult = DialogResult.OK; } this.HourGlass(false); } catch (Exception ex) { this.HourGlass(false); if (this.application != null) this.application.Store.Storage.RollBackTransaction(); this.DialogResult = DialogResult.None; this.ShowError(ex.Message, this.application == null ? Globalization.MultilanguageResource.GetString("frmApplicationProperties_Msg30") : Globalization.MultilanguageResource.GetString("frmApplicationProperties_Msg40")); } }
protected void Page_Load(object sender, EventArgs e) { this.item = (IAzManItem)this.Session["item"]; this.itemType = (ItemType)this.Session["itemType"]; this.application = this.item.Application; switch (this.itemType) { case ItemType.Role: this.setImage("Role_32x32.gif"); this.Text = "Roles list"; break; case ItemType.Task: this.setImage("Task_32x32.gif"); this.Text = "Tasks list"; break; case ItemType.Operation: this.setImage("Operation_32x32.gif"); this.Text = "Operations list"; break; } this.Description = this.Text; this.Title = this.Text; if (!Page.IsPostBack) { this.RefreshItemsList(); } }
private void raiseApplicationGroupDeleted(IAzManApplication ownerApplication, string applicationGroupName) { if (this.ApplicationGroupDeleted != null) { this.ApplicationGroupDeleted(ownerApplication, applicationGroupName); } }
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(); } }
private void SaveRecord() { try { _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted); switch (_Mode) { case Mode.Create: _Application = _Store.CreateApplication(txtName.Text.Trim(), txtDescription.Text); break; case Mode.Update: _Application.Rename(this.txtName.Text.Trim()); _Application.Update(this.txtDescription.Text.Trim()); _Storage.CommitTransaction(); break; } _Storage.CommitTransaction(); } catch (Exception ex) { _Storage.RollBackTransaction(); throw ex; } }
private void raiseApplicationCreated(IAzManStore store, IAzManApplication applicationCreated) { if (this.ApplicationCreated != null) { this.ApplicationCreated(store, applicationCreated); } }
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(); } }
private void btnOk_Click(object sender, EventArgs e) { try { this.HourGlass(true); //Create if (this.application == null) { this.application = this.store.CreateApplication(this.txtName.Text, this.txtDescription.Text); this.DialogResult = DialogResult.OK; } else { this.application.Store.Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted); this.application.Rename(this.txtName.Text.Trim()); this.application.Update(this.txtDescription.Text.Trim()); this.application.Store.Storage.CommitTransaction(); this.DialogResult = DialogResult.OK; } this.HourGlass(false); } catch (Exception ex) { this.HourGlass(false); if (this.application != null) { this.application.Store.Storage.RollBackTransaction(); } this.DialogResult = DialogResult.None; this.ShowError(ex.Message, this.application == null ? Globalization.MultilanguageResource.GetString("frmApplicationProperties_Msg30") : Globalization.MultilanguageResource.GetString("frmApplicationProperties_Msg40")); } }
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(); }
/// <summary> /// Gets a list of users in the specified role for the configured applicationName. /// </summary> /// <param name="roleName">The name of the role to get the list of users for.</param> /// <returns> /// A string array containing the names of all the users who are members of the specified role for the configured applicationName. /// </returns> public override string[] GetUsersInRole(string roleName) { using (IAzManStorage storage = new SqlAzManStorage(this.storageCache.ConnectionString)) { IAzManApplication application = storage[this.storeName][this.applicationName]; IAzManItem role = application[roleName]; if (role.ItemType != ItemType.Role) { throw new ArgumentException(String.Format("{0} must be a Role.", roleName), "roleName"); } IAzManAuthorization[] authz = role.GetAuthorizations(); List <string> users = new List <string>(); foreach (IAzManAuthorization auth in authz) { if (auth.AuthorizationType == AuthorizationType.Allow || auth.AuthorizationType == AuthorizationType.AllowWithDelegation) { if (auth.SidWhereDefined == WhereDefined.Local || auth.SidWhereDefined == WhereDefined.LDAP) { string displayName; auth.GetMemberInfo(out displayName); users.Add(displayName); } else if (auth.SidWhereDefined == WhereDefined.Database) { users.Add(application.GetDBUser(auth.SID).UserName); } } } return(users.ToArray()); } }
public bool AddRole(string user, string application, string role) { const string store = "CATS"; string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["CatsContext"].ConnectionString; IAzManStorage storage = new SqlAzManStorage(connectionString); IAzManStore mystore = storage.GetStore(store); //or storage["My Store"] IAzManApplication myapp = mystore.GetApplication(application); //mystore.GetApplications(); IAzManItem azManRole = myapp.GetItem(role); IAzManAuthorization dele = azManRole.CreateAuthorization( mystore.GetDBUser("Admin").CustomSid, WhereDefined.Database, mystore.GetDBUser(user).CustomSid, WhereDefined.Database, AuthorizationType.AllowWithDelegation, null, null ); //IAzManAuthorization del = azManRole.CreateDelegateAuthorization(mystore.GetDBUser("Admin"),mystore.GetDBUser(user).CustomSid,RestrictedAuthorizationType.Allow, null,null); return(true); }
internal static SqlAzManException ApplicationGroupDuplicateException(string applicationGroupName, IAzManApplication application, Exception innerException) { SqlAzManException ex = new SqlAzManException(String.Format("An Application Group with the same name already exists: '{0}'. Store '{1}', Application '{2}'.", applicationGroupName, application.Store.Name, application.Name), innerException); addParameter(ex, "Application Group name", applicationGroupName); addParameter(ex, application); return ex; }
/// <summary> /// Remove Authorization Delegate /// </summary> private void RemoveDelegate() { // USER MUST BE A MEMBER OF SQL DATABASE ROLE: NetSqlAzMan_Users //Sql Storage connection string string sqlConnectionString = "data source=(local);initial catalog=NetSqlAzManStorage;user id=netsqlazmanuser;password=password"; //Create an instance of SqlAzManStorage class IAzManStorage storage = new SqlAzManStorage(sqlConnectionString); IAzManStore mystore = storage.GetStore("My Store"); //or storage["My Store"] IAzManApplication myapp = mystore.GetApplication("My Application"); IAzManItem myop = myapp.GetItem("My Operation"); //Retrieve current user identity (delegating user) WindowsIdentity userIdentity = ((System.Threading.Thread.CurrentPrincipal.Identity as WindowsIdentity) ?? WindowsIdentity.GetCurrent()); //for Windows Applications //WindowsIdentity userIdentity = this.Request.LogonUserIdentity; //for ASP.NET Applications //Retrieve delegate user Login NTAccount delegateUserLogin = new NTAccount("DOMAIN", "delegateuseraccount"); //Retrieve delegate user SID SecurityIdentifier delegateSID = (SecurityIdentifier)delegateUserLogin.Translate(typeof(SecurityIdentifier)); IAzManSid delegateNetSqlAzManSID = new SqlAzManSID(delegateSID); //Estabilish delegate authorization (only Allow or Deny) RestrictedAuthorizationType delegateAuthorization = RestrictedAuthorizationType.Allow; //Remove delegate and all custom attributes myop.DeleteDelegateAuthorization(userIdentity, delegateNetSqlAzManSID, delegateAuthorization); }
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(); }
protected void btnCreateStore_Click(object sender, EventArgs e) { IAzManStorage storage = new SqlAzManStorage(ConfigurationManager.ConnectionStrings["NetSqlAzManStorage"].ConnectionString); storage.OpenConnection(); try { storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted); IAzManStore store = storage.CreateStore("Store Created Programmatically", "store description"); for (int i = 0; i < 10; i++) { IAzManApplication app = store.CreateApplication("App " + i.ToString(), "application description"); IAzManItem prevItem = null; for (int j = 0; j < 10; j++) { IAzManItem item = app.CreateItem("Item " + j.ToString(), "item description", ItemType.Operation); if (prevItem != null) { item.AddMember(prevItem); } prevItem = item; } } storage.CommitTransaction(); } catch { storage.RollBackTransaction(); throw; } finally { storage.CloseConnection(); } }
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(); }
private void raiseApplicationOpened(IAzManApplication application) { if (this.ApplicationOpened != null) { this.ApplicationOpened(application); } }
protected void Page_Load(object sender, EventArgs e) { this.application = this.Session["selectedObject"] as IAzManApplication; this.Session["application"] = this.application; this.Text = "Check Access Test"; this.Description = this.Text; this.Title = this.Text; this.showWaitPanelOnSubmit(this.pnlWait, this.pnlCheckAccessTest); if (!Page.IsPostBack) { this.wid = this.Request.LogonUserIdentity; NTAccount nta = (NTAccount)this.wid.User.Translate(typeof(NTAccount)); string currentUpnName = nta.Value; if (currentUpnName.IndexOf('\\') != -1) { currentUpnName = currentUpnName.Substring(currentUpnName.IndexOf('\\') + 1); } this.dtValidFor.Text = DateTime.Now.ToString(); this.rbCheckedChanged(); this.txtWindowsUser.Text = currentUpnName; this.txtWindowsUser.Focus(); } if (this.Session["selectedDBUsers"] != null) { this.btnBrowseDBUser_Click(this, EventArgs.Empty); } DateTime odt; if (!DateTime.TryParse(this.dtValidFor.Text, out odt)) { this.ShowError("Valid For must be a valid Date."); this.dtValidFor.Focus(); return; } }
public frmDBUsersList() { InitializeComponent(); this.selectedDBUsers = null; this.store = null; this.application = null; }
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(); }
/// <summary> /// Removes a role from the data source for the configured applicationName. /// </summary> /// <param name="roleName">The name of the role to delete.</param> /// <param name="throwOnPopulatedRole">If true, throw an exception if roleName has one or more members and do not delete roleName.</param> /// <returns> /// true if the role was successfully deleted; otherwise, false. /// </returns> public override bool DeleteRole(string roleName, bool throwOnPopulatedRole) { using (IAzManStorage storage = new SqlAzManStorage(this.storageCache.ConnectionString)) { IAzManApplication application = storage[this.storeName][this.applicationName]; IAzManItem role = application[roleName]; if (role == null) { throw new ArgumentNullException("roleName"); } if (roleName.Trim() == String.Empty) { throw new ArgumentException("roleName parameter cannot be empty."); } if (role.ItemType != ItemType.Role) { throw new ArgumentException(String.Format("{0} must be a Role.", roleName), "roleName"); } if (throwOnPopulatedRole && application[roleName].GetMembers().Length > 0) { throw new ProviderException(String.Format("{0} has one or more members and cannot be deleted.", roleName)); } role.Delete(); //Rebuild StorageCache this.InvalidateCache(false); return(true); } }
/// <summary> /// Adds the specified user names to the specified roles for the configured applicationName. /// </summary> /// <param name="usernames">A string array of user names to be added to the specified roles.</param> /// <param name="roleNames">A string array of the role names to add the specified user names to.</param> public override void AddUsersToRoles(string[] usernames, string[] roleNames) { using (IAzManStorage storage = new SqlAzManStorage(this.storageCache.ConnectionString)) { try { storage.OpenConnection(); storage.BeginTransaction(); IAzManApplication application = storage[this.storeName][this.applicationName]; foreach (string roleName in roleNames) { IAzManItem role = application.GetItem(roleName); if (role.ItemType != ItemType.Role) { throw new ArgumentException(String.Format("{0} must be a Role.", roleName)); } foreach (string username in usernames) { IAzManSid owner = new SqlAzManSID(((System.Threading.Thread.CurrentPrincipal.Identity as WindowsIdentity) ?? WindowsIdentity.GetCurrent()).User); WhereDefined whereDefined = WhereDefined.LDAP; if (this.userLookupType == "LDAP") { string fqun = this.getFQUN(username); NTAccount ntaccount = new NTAccount(fqun); if (ntaccount == null) { throw SqlAzManException.UserNotFoundException(username, null); } IAzManSid sid = new SqlAzManSID(((SecurityIdentifier)(ntaccount.Translate(typeof(SecurityIdentifier))))); if (sid == null) { throw SqlAzManException.UserNotFoundException(username, null); } role.CreateAuthorization(owner, whereDefined, sid, WhereDefined.LDAP, AuthorizationType.Allow, null, null); } else { var dbuser = application.GetDBUser(username); IAzManSid sid = dbuser.CustomSid; role.CreateAuthorization(owner, whereDefined, sid, WhereDefined.Database, AuthorizationType.Allow, null, null); } } } storage.CommitTransaction(); //Rebuild StorageCache this.InvalidateCache(false); } catch { storage.RollBackTransaction(); throw; } finally { storage.CloseConnection(); } } }
/// <summary> /// Gets the DB user. /// </summary> /// <param name="dbUserName">Name of the db user.</param> /// <returns></returns> /// <remarks>Thread-Safe</remarks> public virtual IAzManDBUser GetDBUser(string dbUserName) { using (IAzManStorage storage = new SqlAzManStorage(this.storageCache.ConnectionString)) { IAzManApplication application = storage[this.storeName][this.applicationName]; return(application.GetDBUser(dbUserName)); } }
internal static SqlAzManException DBUserNotFoundException(string dbUserName, IAzManApplication application, Exception innerException) { SqlAzManException ex = new SqlAzManException(String.Format("DB User '{0}' not found. Store '{1}', Application '{2}'.", dbUserName, application.Store.Name, application.Name), innerException); addParameter(ex, "DB User name", dbUserName); addParameter(ex, application); return(ex); }
internal static SqlAzManException ItemDuplicateException(string itemName, IAzManApplication application, Exception innerException) { SqlAzManException ex = new SqlAzManException(String.Format("An Item with the same name already exists: '{0}'. Store '{1}'. Application '{2}'.", itemName, application.Store.Name, application.Name), innerException); addParameter(ex, "Item name", itemName); addParameter(ex, "Item name", application); return(ex); }
/// <summary> /// Adds a new role to the data source for the configured applicationName. /// </summary> /// <param name="roleName">The name of the role to create.</param> public override void CreateRole(string roleName) { using (IAzManStorage storage = new SqlAzManStorage(this.storageCache.ConnectionString)) { IAzManApplication application = storage[this.storeName][this.applicationName]; application.CreateItem(roleName, String.Empty, ItemType.Role); } //Rebuild StorageCache this.InvalidateCache(false); }
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 Attributes: {0}", this.application.Name); this.Title = this.Text; this.Description = this.Text; if (!Page.IsPostBack) { this.bindGridView(); } }
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; }
/// <summary> /// Primary method that build menu. This method examines all of the 'applications' that are /// present in a 'store' under the NetSqlAzMan model. Any valid menus are added to this instance. /// </summary> private void GetMenu() { try { IAzManStore store = _storage.GetStore(_store); // Am I allowed in this store (city)? This is top-level check. if (store.CheckStoreAccess(_dbUser, DateTime.Now, null)) { foreach (var applicationKvp in store.Applications) { IAzManApplication application = applicationKvp.Value; // Are there any menu items under this application that user has rights to? // If not then continue on to next application if (!_displayFullMenu && !application.CheckApplicationAccess(_dbUser, DateTime.Now, null)) { continue; } // Check if there is a menu at this (app) level. // If the application has a task named the same as the application then derive // the MenuItem item from that Task. It is possible for the application to not have a menu. PemsMenuItem appMenuItem = application.Items.ContainsKey(application.Name) ? GetTaskMenu(application.Items[application.Name]) : null; if (appMenuItem != null) { // Get any child menu items. GetTaskMenuItems(application.Name, appMenuItem, application.Items, 0); appMenuItem.Sort(); // Add present top-level app menu if it has children or has explicit link. if (appMenuItem.Url != null || appMenuItem.Count > 0) { Add(appMenuItem); } } } } } catch (Exception ex) { // If any exception, clear menu. Clear(); } // Prune dead branches. Prune(this); // Sort the menu list by Order this.Sort(); }
internal SqlAzManItem(NetSqlAzManStorageDataContext db, IAzManApplication application, int itemId, string name, string description, ItemType itemType, string bizRule, BizRuleSourceLanguage? bizRuleScriptLanguage, SqlAzManENS ens) { this.db = db; this.itemId = itemId; this.application = application; this.name = name; this.bizRuleSource = bizRule; this.bizRuleSourceLanguage = bizRuleScriptLanguage; this.description = description; this.itemType = itemType; this.ens = ens; }
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 ApplicationGroupsScopeNode(IAzManApplication application) : base(!application.HasApplicationGroups()) { this.application = application; // Create a message view for the Application Groups node. MMC.MmcListViewDescription lvdApplicationGroups = new MMC.MmcListViewDescription(); lvdApplicationGroups.DisplayName = Globalization.MultilanguageResource.GetString("ListView_Msg20"); lvdApplicationGroups.ViewType = typeof(ApplicationGroupsListView); lvdApplicationGroups.Options = MMC.MmcListViewOptions.AllowUserInitiatedModeChanges; this.ViewDescriptions.Clear(); this.ViewDescriptions.Add(lvdApplicationGroups); this.ViewDescriptions.DefaultIndex = 0; this.RenderApplicationGroups(); }
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.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(); } }
public ItemDefinitionsScopeNode(IAzManApplication application) : base() { this.application = application; // Create a message view for the Store Groups node. MMC.MmcListViewDescription lvdStoreGroups = new MMC.MmcListViewDescription(); lvdStoreGroups.DisplayName = Globalization.MultilanguageResource.GetString("Folder_Msg30"); lvdStoreGroups.ViewType = typeof(ItemDefinitionsListView); lvdStoreGroups.Options = MMC.MmcListViewOptions.AllowUserInitiatedModeChanges; this.ViewDescriptions.Clear(); this.ViewDescriptions.Add(lvdStoreGroups); this.ViewDescriptions.DefaultIndex = 0; this.RenderItemDefinitions(); }
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(); } }
internal SqlAzManApplicationGroup(NetSqlAzManStorageDataContext db, IAzManApplication application, int applicationGroupId, IAzManSid sid, string name, string description, string lDapQuery, GroupType groupType, SqlAzManENS ens) { this.db = db; this.application = application; this.applicationGroupId = applicationGroupId; this.sid = sid; this.name = name; this.description = description; this.lDapQuery = String.IsNullOrEmpty(lDapQuery) ? String.Empty : lDapQuery; this.groupType = groupType; this.ens = ens; if (groupType != GroupType.Basic) { this.members = new Dictionary<IAzManSid, IAzManApplicationGroupMember>(); } }
protected void btnOk_Click(object sender, EventArgs e) { try { //Create if (this.application == null) { this.application = this.store.CreateApplication(this.txtName.Text, this.txtDescription.Text); string suffix = String.Empty; if (this.application.IAmAdmin) suffix = " (Admin)"; else if (this.application.IAmManager) suffix = " (Manager)"; else if (this.application.IAmUser) suffix = " (User)"; else if (this.application.IAmReader) suffix = " (Reader)"; this.Session["FindChildNodeText"] = this.application.Name + suffix; this.closeWindow(true); } else { this.storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted); this.application.Rename(this.txtName.Text.Trim()); this.application.Update(this.txtDescription.Text.Trim()); this.storage.CommitTransaction(); string suffix = String.Empty; if (this.application.IAmAdmin) suffix = " (Admin)"; else if (this.application.IAmManager) suffix = " (Manager)"; else if (this.application.IAmUser) suffix = " (User)"; else if (this.application.IAmReader) suffix = " (Reader)"; this.Session["FindNodeText"] = this.application.Name + suffix; this.closeWindow(true); } } catch (Exception ex) { if (this.application != null) this.storage.RollBackTransaction(); this.ShowError(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { IAzManStorage storage = new SqlAzManStorage(ConfigurationManager.ConnectionStrings["NetSqlAzManStorage"].ConnectionString); this.application = storage[ConfigurationManager.AppSettings["StoreName"]][ConfigurationManager.AppSettings["ApplicationName"]]; //Get user Identity this.identity = this.Request.LogonUserIdentity; this.lblIAM.Text = this.identity.Name; //Print DateTime this.lblDateTime.Text = DateTime.Now.ToString(); //Check Access on Items this.application.Store.Storage.OpenConnection(); this.btnBudgetCheck.Enabled = this.checkAccessHelper("Controllo del Budget"); this.btnCustomerRelationshipManagement.Enabled = this.checkAccessHelper("Relazioni con i Clienti"); this.btnConstraintCheck.Enabled = this.checkAccessHelper("Controllo dei Vincoli"); this.btnTimesheetCheck.Enabled = this.checkAccessHelper("Approvazione del TimeSheet"); this.btnTimesheetCompile.Enabled = this.checkAccessHelper("Compilazione del Timesheet"); this.btnDevelopment.Enabled = this.checkAccessHelper("Sviluppo"); //Can delegate ? NTAccount delegatedNTAccount = new NTAccount("ProductManager1"); SecurityIdentifier delegatedSid = (SecurityIdentifier)delegatedNTAccount.Translate(typeof(SecurityIdentifier)); bool canDelegate = this.checkAccessForDelegationHelper("Controllo del Budget"); bool alreadyDelegate = this.application["Controllo del Budget"].GetAuthorizations(new SqlAzManSID(this.identity.User), new SqlAzManSID(delegatedSid)).Length > 0; this.btnDelegateForBudgetCheck.Enabled = canDelegate && !alreadyDelegate; this.btnUndelegate.Enabled = canDelegate && alreadyDelegate; //Attributes IAzManAuthorization[] auths = this.application["Controllo del Budget"].GetAuthorizationsOfMember(new SqlAzManSID(this.identity.User)); string toolTip = String.Empty; foreach (IAzManAuthorization auth in auths) { IAzManAttribute<IAzManAuthorization>[] attribs = auth.GetAttributes(); foreach (IAzManAttribute<IAzManAuthorization> attrib in attribs) { toolTip += String.Format("{0} - {1}\r\n", attrib.Key, attrib.Value); } } this.btnBudgetCheck.ToolTip = toolTip; this.application.Store.Storage.CloseConnection(); }
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 (this.Session["selectedObject"] as IAzManApplication != null) { this.application = this.Session["selectedObject"] as IAzManApplication; } if (!Page.IsPostBack) { if (this.application != null) { this.btnPermissions.Enabled = true; this.btnAttributes.Enabled = true; this.txtName.Text = this.application.Name; this.txtDescription.Text = this.application.Description; this.txtName.Focus(); this.Text = "Application Properties - " + this.application.Name; this.Title = this.Text; this.Description = "Application Properties"; if (!this.application.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 Application"; this.Text = "New Application"; this.Title = this.Text; } this.txtName.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 = String.Format("Application Permissions: {0}", this.application.Name); this.Title = this.Text; this.Description = "Application Permissions"; if (!Page.IsPostBack) this.RefreshApplicationPermissions(); }
void ItemsHVAction_Triggered(object sender, MMC.SyncActionEventArgs e) { IAzManApplication[] applications = new IAzManApplication[this.SelectedNodes.Count]; int index = 0; foreach (ApplicationScopeNode applicationScopeNode in this.SelectedNodes) { applications[index++] = applicationScopeNode.Application; } frmItemsHierarchyView frm = new frmItemsHierarchyView(); frm.applications = applications; this.SnapIn.Console.ShowDialog(frm); }
private void SetHirearchy(IAzScope azScope, IAzApplication azApplication, string taskName, IAzManApplication application) { IAzTask azTask = null; if (azScope == null) azTask = azApplication.OpenTask(taskName, null); else azTask = azScope.OpenTask(taskName, null); IAzManItem item = application.GetItem(taskName); if (azTask != null) { //SubTasks object[] azSubTasks = azTask.Tasks as object[]; if (azSubTasks != null) { foreach (string azSubTask in azSubTasks) { IAzManItem subItem = application.GetItem(azSubTask); item.AddMember(subItem); //this.SetHirearchy(azScope, azApplication, azSubTask, application); } } //SubOperations object[] azSubOperations = azTask.Operations as object[]; if (azSubOperations != null) { foreach (string azSubOperation in azSubOperations) { IAzManItem subItem = application.GetItem(azSubOperation); item.AddMember(subItem); } } } }
private void add(TreeNode parent, IAzManApplication app) { TreeNode node = new TreeNode(app.Name, 2, 2); node.ToolTipText = app.Description; node.Tag = app; parent.Nodes.Add(node); node.Expand(); foreach (IAzManItem item in app.Items.Values) { if (item.ItemType == ItemType.Role) { if (item.ItemsWhereIAmAMember.Count== 0) this.AddRole(node, item, node); /*Application.DoEvents();*/ } } foreach (IAzManItem item in app.Items.Values) { if (item.ItemType == ItemType.Task) { if (item.ItemsWhereIAmAMember.Count == 0) this.AddTask(node, item, node); /*Application.DoEvents();*/ } } foreach (IAzManItem item in app.Items.Values) { if (item.ItemType == ItemType.Operation) { if (item.ItemsWhereIAmAMember.Count == 0) this.AddOperation(node, item, node); /*Application.DoEvents();*/ } } node.Collapse(); }
private void raiseUpdated(IAzManApplication application, string oldDescription) { if (this.ApplicationUpdated != null) this.ApplicationUpdated(application, oldDescription); }
void application_Updated(IAzManApplication application, string oldDescription) { MessageBox.Show("application_Updated Application " + application.Name + " ha cambiato descrizione da " + oldDescription + " a " + application.Description); }
private void raiseItemCreated(IAzManApplication application, IAzManItem itemCreated) { if (this.ItemCreated != null) this.ItemCreated(application, itemCreated); }
private void raiseRenamed(IAzManApplication application, string oldName) { if (this.ApplicationRenamed != null) this.ApplicationRenamed(application, oldName); }
private void raiseApplicationGroupCreated(IAzManApplication application, IAzManApplicationGroup applicationGroupCreated) { if (this.ApplicationGroupCreated != null) this.ApplicationGroupCreated(application, applicationGroupCreated); }
private void raiseApplicationPermissionRevoked(IAzManApplication owner, string sqlLogin, string role) { if (this.ApplicationPermissionRevoked != null) this.ApplicationPermissionRevoked(owner, sqlLogin, role); }
private void raiseApplicationAttributeCreated(IAzManApplication owner, IAzManAttribute<IAzManApplication> attributeCreated) { if (this.ApplicationAttributeCreated != null) this.ApplicationAttributeCreated(owner, attributeCreated); }
private void add(TreeNode parent, IAzManApplication app) { TreeNode node = new TreeNode(app.Name, app.Name, this.getImageUrl("Application_16x16.gif")); node.ToolTip = app.Description; parent.ChildNodes.Add(node); node.Expand(); foreach (IAzManItem item in app.Items.Values) { if (item.ItemType == ItemType.Role) { if (item.ItemsWhereIAmAMember.Count == 0) this.AddRole(node, item, node); } } foreach (IAzManItem item in app.Items.Values) { if (item.ItemType == ItemType.Task) { if (item.ItemsWhereIAmAMember.Count == 0) this.AddTask(node, item, node); } } if (app.Store.Storage.Mode == NetSqlAzManMode.Developer) { foreach (IAzManItem item in app.Items.Values) { if (item.ItemType == ItemType.Operation) { if (item.ItemsWhereIAmAMember.Count == 0) this.AddOperation(node, item, node); } } } node.Collapse(); }
/// <summary> /// Adds an IAzManApplication publisher. /// </summary> /// <param name="publisher">The application.</param> internal void AddPublisher(IAzManApplication publisher) { publisher.ApplicationAttributeCreated += new AttributeCreatedDelegate<IAzManApplication>(delegate(IAzManApplication owner, IAzManAttribute<IAzManApplication> attributeCreated) { if (this.ApplicationAttributeCreated != null) this.ApplicationAttributeCreated(owner, attributeCreated); }); publisher.ApplicationGroupCreated += new ApplicationGroupCreatedDelegate(delegate(IAzManApplication application, IAzManApplicationGroup applicationGroupcreated) { if (this.ApplicationGroupCreated != null) this.ApplicationGroupCreated(application, applicationGroupcreated); }); publisher.ApplicationDeleted += new ApplicationDeletedDelegate(delegate(IAzManStore ownerStore, string applicationName) { if (this.ApplicationDeleted != null) this.ApplicationDeleted(ownerStore, applicationName); }); publisher.ItemCreated+=new ItemCreatedDelegate(delegate(IAzManApplication application, IAzManItem itemCreated) { if (this.ItemCreated!=null) this.ItemCreated(application, itemCreated); }); publisher.ApplicationRenamed += new ApplicationRenamedDelegate(delegate(IAzManApplication application, string oldName) { if (this.ApplicationRenamed != null) this.ApplicationRenamed(application, oldName); }); publisher.ApplicationUpdated += new ApplicationUpdatedDelegate(delegate(IAzManApplication application, string oldDescription) { if (this.ApplicationUpdated != null) this.ApplicationUpdated(application, oldDescription); } ); publisher.ApplicationPermissionGranted += new ApplicationPermissionGrantedDelegate(delegate(IAzManApplication application, string sqlLogin, string role) { if (this.ApplicationPermissionGranted != null) this.ApplicationPermissionGranted(application, sqlLogin, role); }); publisher.ApplicationPermissionRevoked += new ApplicationPermissionRevokedDelegate(delegate(IAzManApplication application, string sqlLogin, string role) { if (this.ApplicationPermissionRevoked != null) this.ApplicationPermissionRevoked(application, sqlLogin, role); }); }
public ApplicationScopeNode(IAzManApplication application) { this.application = application; this.Render(); }
void ItemsHReportAction_Triggered(object sender, MMC.SyncActionEventArgs e) { IAzManApplication[] applications = new IAzManApplication[this.SelectedNodes.Count]; int index = 0; foreach (ApplicationScopeNode applicationScopeNode in this.SelectedNodes) { applications[index++] = applicationScopeNode.Application; } frmPrint frm = new frmPrint(); ptItemsHierarchy rep = new ptItemsHierarchy(); rep.Applications = applications; frm.document = rep; this.SnapIn.Console.ShowDialog(frm); }