private void btnOk_Click(object sender, EventArgs e) { try { this.HourGlass(true); //Create if (this.store == null) { this.store = this.storage.CreateStore(this.txtName.Text, this.txtDescription.Text); this.DialogResult = DialogResult.OK; } else { this.storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted); this.store.Rename(this.txtName.Text.Trim()); this.store.Update(this.txtDescription.Text.Trim()); this.storage.CommitTransaction(); this.DialogResult = DialogResult.OK; } this.HourGlass(false); } catch (Exception ex) { this.HourGlass(false); if (this.store != null) this.storage.RollBackTransaction(); this.DialogResult = DialogResult.None; this.ShowError(ex.Message, this.store == null ? Globalization.MultilanguageResource.GetString("frmStoreProperties_Msg40") : Globalization.MultilanguageResource.GetString("frmStoreProperties_Msg50")); } }
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(); } }
public frmDBUsersList() { InitializeComponent(); this.selectedDBUsers = null; this.store = null; this.application = null; }
internal static SqlAzManException ApplicationDuplicateException(string applicationName, IAzManStore store, Exception innerException) { SqlAzManException ex = new SqlAzManException(String.Format("An Application with the same name already exists: '{0}'. Store '{1}'.", applicationName, store.Name), innerException); addParameter(ex, "Application name", applicationName); addParameter(ex, store); return ex; }
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(); } }
internal SqlAzManApplication(NetSqlAzManStorageDataContext db, IAzManStore store, int applicationId, string name, string description, byte netsqlazmanFixedServerRole, SqlAzManENS ens) { this.db = db; this.applicationId = applicationId; this.store = store; this.name = name; this.description = description; this.netsqlazmanFixedServerRole = netsqlazmanFixedServerRole; this.ens = ens; }
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.store = this.Session["selectedObject"] as IAzManStore; if (!Page.IsPostBack) { this.txtName.Focus(); this.Text = "New Store Group"; this.Title = this.Text; this.Description = this.Text; this.txtName.Focus(); } }
public StoreGroupsScopeNode(IAzManStore store) : base(!store.HasStoreGroups()) { this.store = store; // Create a message view for the Store Groups node. MMC.MmcListViewDescription lvdStoreGroups = new MMC.MmcListViewDescription(); lvdStoreGroups.DisplayName = Globalization.MultilanguageResource.GetString("Folder_Msg90"); lvdStoreGroups.ViewType = typeof(StoreGroupsListView); lvdStoreGroups.Options = MMC.MmcListViewOptions.AllowUserInitiatedModeChanges; this.ViewDescriptions.Clear(); this.ViewDescriptions.Add(lvdStoreGroups); this.ViewDescriptions.DefaultIndex = 0; this.RenderStoreGroups(); }
public StoreScopeNode(IAzManStore store) { //Prepare Node this.store = store; // Create a message view for the Store node. MMC.MmcListViewDescription lvdItems = new MMC.MmcListViewDescription(); lvdItems.DisplayName = Globalization.MultilanguageResource.GetString("Folder_Msg100"); lvdItems.ViewType = typeof(StoreGroupsAndApplicationsListView); lvdItems.Options = MMC.MmcListViewOptions.AllowUserInitiatedModeChanges; this.ViewDescriptions.Clear(); this.ViewDescriptions.Add(lvdItems); this.ViewDescriptions.DefaultIndex = 0; this.Children.Clear(); this.RenderStoreScopeNode(); }
internal SqlAzManStoreGroup(NetSqlAzManStorageDataContext db, IAzManStore store, int storeGroupId, IAzManSid sid, string name, string description, string lDapQuery, GroupType groupType, SqlAzManENS ens) { this.db = db; this.store = store; this.storeGroupId = storeGroupId; 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, IAzManStoreGroupMember>(); } }
protected void btnOk_Click(object sender, EventArgs e) { try { //Create if (this.store == null) { this.store = this.storage.CreateStore(this.txtName.Text, this.txtDescription.Text); string suffix = String.Empty; if (this.store.IAmAdmin) suffix = " (Admin)"; else if (this.store.IAmManager) suffix = " (Manager)"; else if (this.store.IAmUser) suffix = " (User)"; else if (this.store.IAmReader) suffix = " (Reader)"; this.Session["FindChildNodeText"] = this.store.Name+suffix; this.closeWindow(true); } else { this.storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted); this.store.Rename(this.txtName.Text.Trim()); this.store.Update(this.txtDescription.Text.Trim()); this.storage.CommitTransaction(); string suffix = String.Empty; if (this.store.IAmAdmin) suffix = " (Admin)"; else if (this.store.IAmManager) suffix = " (Manager)"; else if (this.store.IAmUser) suffix = " (User)"; else if (this.store.IAmReader) suffix = " (Reader)"; this.Session["FindNodeText"] = this.store.Name+suffix; this.closeWindow(true); } } catch (Exception ex) { if (this.store != null) this.storage.RollBackTransaction(); this.ShowError(ex.Message); } }
private void raiseDeleted(IAzManStore ownerStore, string applicationName) { if (this.ApplicationDeleted != null) this.ApplicationDeleted(ownerStore, applicationName); }
void SqlAzManENS_StorePermissionRevoked(IAzManStore store, string sqlLogin, string role) { logging.WriteInfo(this, String.Format("ENS Event: {0}\r\n\r\nStore: {1}\r\nSql Login: {2}\r\nRole: {3}", "StorePermissionRevoked", store.ToString(), sqlLogin, role)); }
void SqlAzManENS_StoreRenamed(IAzManStore store, string oldName) { logging.WriteInfo(this, String.Format("ENS Event: {0}\r\n\r\nStore: {1}\r\nOld Name: {2}\r\n", "StoreRenamed", store.ToString(), oldName)); }
/// <summary> /// Adds the IAzManStore publisher. /// </summary> /// <param name="publisher">The publisher.</param> internal void AddPublisher(IAzManStore publisher) { publisher.StoreAttributeCreated += new AttributeCreatedDelegate<IAzManStore>(delegate(IAzManStore owner, IAzManAttribute<IAzManStore> attributeCreated) { if (this.StoreAttributeCreated != null) this.StoreAttributeCreated(owner, attributeCreated); }); publisher.ApplicationOpened+=new ApplicationOpenedDelegate(delegate(IAzManApplication application) { if (this.ApplicationOpened!=null) this.ApplicationOpened(application); }); publisher.ApplicationCreated += new ApplicationCreatedDelegate(delegate(IAzManStore store, IAzManApplication applicationCreated) { if (this.ApplicationCreated != null) this.ApplicationCreated(store, applicationCreated); }); publisher.StoreDeleted += new StoreDeletedDelegate(delegate(IAzManStorage ownerStorage, string storeName) { if (this.StoreDeleted != null) this.StoreDeleted(ownerStorage, storeName); }); publisher.StoreGroupCreated += new StoreGroupCreatedDelegate(delegate(IAzManStore store, IAzManStoreGroup storeGroupCreated) { if (this.StoreGroupCreated != null) this.StoreGroupCreated(store, storeGroupCreated); }); publisher.StoreRenamed += new StoreRenamedDelegate(delegate(IAzManStore store, string oldName) { if (this.StoreRenamed != null) this.StoreRenamed(store, oldName); }); publisher.StoreUpdated += new StoreUpdatedDelegate(delegate(IAzManStore store, string oldDescription) { if (this.StoreUpdated != null) this.StoreUpdated(store, oldDescription); }); publisher.StorePermissionGranted += new StorePermissionGrantedDelegate(delegate(IAzManStore store, string sqlLogin, string role) { if (this.StorePermissionGranted != null) this.StorePermissionGranted(store, sqlLogin, role); }); publisher.StorePermissionRevoked += new StorePermissionRevokedDelegate(delegate(IAzManStore store, string sqlLogin, string role) { if (this.StorePermissionRevoked != null) this.StorePermissionRevoked(store, sqlLogin, role); }); }
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 SqlAzManENS_StoreUpdated(IAzManStore store, string oldDescription) { logging.WriteInfo(this, String.Format("ENS Event: {0}\r\n\r\nStore: {1}\r\nOld Description: {2}\r\n", "StoreUpdated", store.ToString(), oldDescription)); }
internal AuthorizationType internalCheckAccess(IAzManStore store, IAzManApplication application, IAzManItem item, IEnumerable<IAzManItem> allItems, string userSSid, string[] groupsSSid, DateTime validFor, bool operationsOnly, bool retrieveAttributes, out List<KeyValuePair<string, string>> attributes, params KeyValuePair<string, object>[] contextParameters) { AuthorizationType authorizationType = AuthorizationType.Neutral; attributes = new List<KeyValuePair<string, string>>(); #region RECURSIVE CALL var parentItems = from t in allItems where t.Members.ContainsKey(item.Name) select t; foreach (var parentItem in parentItems) { AuthorizationType parentAuthorizationType; if (!itemResultCache.ContainsKey(parentItem.Name)) { List<KeyValuePair<string, string>> localAttributes; parentAuthorizationType = this.internalCheckAccess(store, application, parentItem, allItems, userSSid, groupsSSid, validFor, operationsOnly, retrieveAttributes, out localAttributes, contextParameters); if (retrieveAttributes && (parentAuthorizationType == AuthorizationType.Allow || parentAuthorizationType == AuthorizationType.AllowWithDelegation)) attributes.AddRange(localAttributes); } else { parentAuthorizationType = (AuthorizationType)itemResultCache[parentItem.Name]; List<KeyValuePair<string, string>> localAttributes = (List<KeyValuePair<String, String>>)attributesResultCache[parentItem.Name]; if (retrieveAttributes && (parentAuthorizationType == AuthorizationType.Allow || parentAuthorizationType == AuthorizationType.AllowWithDelegation)) attributes.AddRange(localAttributes); } authorizationType = SqlAzManItem.mergeAuthorizations(authorizationType, parentAuthorizationType); } if (authorizationType == AuthorizationType.AllowWithDelegation) authorizationType = AuthorizationType.Allow; //AllowWithDelegation becomes Just Allow (if comes from parents) #endregion RECURSIVE CALL #region BIZ RULE CHECK if (!String.IsNullOrEmpty(item.BizRuleSource)) { try { AuthorizationType forcedCheckAccessResult = authorizationType; Hashtable ctxParameters = new Hashtable(); if (contextParameters != null) { foreach (KeyValuePair<string, object> kv in contextParameters) { ctxParameters.Add(kv.Key, kv.Value); } } bool bizRuleResult = this.storage.executeBizRule(item, new SqlAzManSID(userSSid, true), ctxParameters, ref forcedCheckAccessResult); if (bizRuleResult == true) { authorizationType = SqlAzManItem.mergeAuthorizations(authorizationType, forcedCheckAccessResult); } else { return authorizationType; } } catch (Exception ex) { throw SqlAzManException.BizRuleException(item, ex); } } #endregion BIZ RULE CHECK #region CHECK ACCESS ON ITEM //memo: WhereDefined can be:0 - Store; 1 - Application; 2 - LDAP; 3 - Local; 4 - Database var authz = from a in item.Authorizations where a.Item.ItemId == item.ItemId && String.Equals(a.SID.StringValue, userSSid, StringComparison.OrdinalIgnoreCase) && (a.ValidFrom == null && a.ValidTo == null || validFor >= a.ValidFrom && a.ValidTo == null || validFor <= a.ValidTo && a.ValidFrom == null || validFor >= a.ValidFrom && validFor <= a.ValidTo) && a.AuthorizationType != AuthorizationType.Neutral && ((this.storage.Mode == NetSqlAzManMode.Administrator && (a.SidWhereDefined == WhereDefined.LDAP || a.SidWhereDefined == WhereDefined.Database)) || (this.storage.Mode == NetSqlAzManMode.Developer && a.SidWhereDefined >= WhereDefined.LDAP && a.SidWhereDefined <= WhereDefined.Database)) select a; foreach (var auth in authz) { authorizationType = SqlAzManItem.mergeAuthorizations(authorizationType, auth.AuthorizationType); //Authorization Attributes if (retrieveAttributes) { if (authorizationType == AuthorizationType.Allow || authorizationType == AuthorizationType.AllowWithDelegation) { foreach (IAzManAttribute<IAzManAuthorization> authorizationAttribute in auth.Attributes.Values) { attributes.Add(new KeyValuePair<string, string>(authorizationAttribute.Key, authorizationAttribute.Value)); } } } } #endregion CHECK ACCESS ON ITEM #region CHECK ACCESS FOR USER GROUPS AUTHORIZATIONS authz = from a in item.Authorizations join g in groupsSSid on a.SID.StringValue equals g where String.Equals(a.Item.Name, item.Name, StringComparison.OrdinalIgnoreCase) && (a.ValidFrom == null && a.ValidTo == null || validFor >= a.ValidFrom.Value && a.ValidTo == null || validFor <= a.ValidTo.Value && a.ValidFrom == null || validFor >= a.ValidFrom && validFor <= a.ValidTo.Value) && a.AuthorizationType != AuthorizationType.Neutral && ((this.storage.Mode == NetSqlAzManMode.Administrator && (a.SidWhereDefined == WhereDefined.LDAP || a.SidWhereDefined == WhereDefined.Database)) || (this.storage.Mode == NetSqlAzManMode.Developer && a.SidWhereDefined >= WhereDefined.LDAP && a.SidWhereDefined <= WhereDefined.Database)) select a; foreach (var auth in authz) { authorizationType = SqlAzManItem.mergeAuthorizations(authorizationType, auth.AuthorizationType); //Authorization Attributes if (retrieveAttributes) { if (authorizationType == AuthorizationType.Allow || authorizationType == AuthorizationType.AllowWithDelegation) { foreach (IAzManAttribute<IAzManAuthorization> authorizationAttribute in auth.Attributes.Values) { attributes.Add(new KeyValuePair<string, string>(authorizationAttribute.Key, authorizationAttribute.Value)); } } } } #endregion CHECK ACCESS FOR USER GROUPS AUTHORIZATIONS #region CHECK ACCESS FOR STORE/APPLICATION GROUPS AUTHORIZATIONS bool isMember = true; authz = from a in item.Authorizations where String.Equals(a.Item.Name, item.Name, StringComparison.OrdinalIgnoreCase) && (a.SidWhereDefined == WhereDefined.Store || a.SidWhereDefined == WhereDefined.Application) && (a.ValidFrom == null && a.ValidTo == null || validFor >= a.ValidFrom.Value && a.ValidTo == null || validFor <= a.ValidTo.Value && a.ValidFrom == null || validFor >= a.ValidFrom && validFor <= a.ValidTo.Value) && a.AuthorizationType != AuthorizationType.Neutral select a; foreach (var auth in authz) { isMember = true; //store group members if (auth.SidWhereDefined == WhereDefined.Store) { //check if user is a non-member //non members var nonMembers = this.getStoreGroupSidMembers(store, false, auth.SID); if (nonMembers.FirstOrDefault(m => String.Equals(m.StringValue, userSSid, StringComparison.OrdinalIgnoreCase)) != null || (from m in nonMembers join g in groupsSSid on m.StringValue equals g //where String.Equals(m.StringValue, g, StringComparison.OrdinalIgnoreCase) select g).FirstOrDefault() != null) { isMember = false; } if (isMember == true) { //members var members = this.getStoreGroupSidMembers(store, true, auth.SID); if (members.FirstOrDefault(m => String.Equals(m.StringValue, userSSid, StringComparison.OrdinalIgnoreCase)) != null || (from m in members join g in groupsSSid on m.StringValue equals g //where String.Equals(m.StringValue, g, StringComparison.OrdinalIgnoreCase) select g).FirstOrDefault() != null) { isMember = true; } else { isMember = false; } } //if a member ... get authorization if (isMember == true) { authorizationType = SqlAzManItem.mergeAuthorizations(authorizationType, auth.AuthorizationType); if (retrieveAttributes) { if (authorizationType == AuthorizationType.Allow || authorizationType == AuthorizationType.AllowWithDelegation) { foreach (var attr in auth.Attributes.Values) { attributes.Add(new KeyValuePair<string, string>(attr.Key, attr.Value)); } } } } } else if (auth.SidWhereDefined == WhereDefined.Application) { //application group members var nonMembers = this.getApplicationGroupSidMembers(auth.Item.Application, false, auth.SID); if (nonMembers.Count(m => String.Equals(m.StringValue, userSSid, StringComparison.OrdinalIgnoreCase)) > 0 || (from m in nonMembers join g in groupsSSid on m.StringValue equals g //where String.Equals(m.StringValue ,g, StringComparison.OrdinalIgnoreCase) select g).FirstOrDefault() != null) { isMember = false; } if (isMember == true) { //members var members = this.getApplicationGroupSidMembers(auth.Item.Application, true, auth.SID); if (members.Count(m => String.Equals(m.StringValue, userSSid, StringComparison.OrdinalIgnoreCase)) > 0 || (from m in members join g in groupsSSid on m.StringValue equals g //where String.Equals(m.StringValue, g, StringComparison.OrdinalIgnoreCase) select g).FirstOrDefault() != null) { isMember = true; } else { isMember = false; } } //if a member ... get authorization if (isMember == true) { authorizationType = SqlAzManItem.mergeAuthorizations(authorizationType, auth.AuthorizationType); //Authorization Attributes if (retrieveAttributes) { if (authorizationType == AuthorizationType.Allow || authorizationType == AuthorizationType.AllowWithDelegation) { foreach (var attr in auth.Attributes.Values) { attributes.Add(new KeyValuePair<string, string>(attr.Key, attr.Value)); } } } } } } #endregion CHECK ACCESS FOR STORE/APPLICATION GROUPS AUTHORIZATIONS //Store Attributes if (retrieveAttributes) { if (authorizationType == AuthorizationType.Allow || authorizationType == AuthorizationType.AllowWithDelegation) { foreach (IAzManAttribute<IAzManStore> storeAttribute in item.Application.Store.Attributes.Values) { KeyValuePair<string, string> attr = new KeyValuePair<string, string>(storeAttribute.Key, storeAttribute.Value); if (!attributes.Contains(attr)) attributes.Add(attr); } } } //Application Attributes if (retrieveAttributes) { if (authorizationType == AuthorizationType.Allow || authorizationType == AuthorizationType.AllowWithDelegation) { foreach (IAzManAttribute<IAzManApplication> applicationAttribute in item.Application.Attributes.Values) { KeyValuePair<string, string> attr = new KeyValuePair<string, string>(applicationAttribute.Key, applicationAttribute.Value); if (!attributes.Contains(attr)) attributes.Add(attr); } } } //Item Attributes if (retrieveAttributes) { if (authorizationType == AuthorizationType.Allow || authorizationType == AuthorizationType.AllowWithDelegation) { foreach (IAzManAttribute<IAzManItem> itemAttribute in item.Attributes.Values) { attributes.Add(new KeyValuePair<string, string>(itemAttribute.Key, itemAttribute.Value)); } } } //Cache temporarly the result if (!itemResultCache.ContainsKey(item.Name)) { itemResultCache.Add(item.Name, authorizationType); } if (!attributesResultCache.ContainsKey(item.Name)) { attributesResultCache.Add(item.Name, attributes); } attributes = attributes.Distinct().ToList(); return authorizationType; }
internal static SqlAzManException StoreGroupNotFoundException(string group, IAzManStore store, Exception innerException) { SqlAzManException ex = new SqlAzManException(String.Format("Store Group '{0}' not found. Store '{1}'.", group, store.Name), innerException); addParameter(ex, "Store Group", group); addParameter(ex, store); return ex; }
internal static SqlAzManException DBUserNotFoundException(string dbUserName, IAzManStore store, Exception innerException) { SqlAzManException ex = new SqlAzManException(String.Format("DB User '{0}' not found. Store '{1}'.", dbUserName, store.Name), innerException); addParameter(ex, "DB User name", dbUserName); addParameter(ex, store); return ex; }
void SqlAzManENS_StoreGroupDeleted(IAzManStore ownerStore, string storeGroupName) { logging.WriteInfo(this, String.Format("ENS Event: {0}\r\n\r\nStore: {1}\r\nStore Group Name: {2}\r\n", "StoreGroupDeleted", ownerStore.ToString(), storeGroupName)); }
private IEnumerable<IAzManSid> getStoreGroupSidMembers(IAzManStore store, bool isMember, IAzManSid groupObjectSid) { IEnumerable<IAzManSid> result = new IAzManSid[0]; var storeGroup = (from sg in store.StoreGroups.Values where sg.SID.StringValue == groupObjectSid.StringValue select sg).First(); //BASIC GROUP if (storeGroup.GroupType == GroupType.Basic) { //Windows SIDs var membersResult = from sgm in storeGroup.Members.Values where sgm.StoreGroup.StoreGroupId == storeGroup.StoreGroupId && sgm.IsMember == isMember && ((this.storage.Mode == NetSqlAzManMode.Administrator && (sgm.WhereDefined == WhereDefined.LDAP || sgm.WhereDefined == WhereDefined.Database)) || (this.storage.Mode == NetSqlAzManMode.Developer && sgm.WhereDefined >= WhereDefined.LDAP && sgm.WhereDefined <= WhereDefined.Database)) select sgm.SID; result = result.Union(membersResult); //Sub Store Groups var subMembers = from sgm in storeGroup.Members.Values where sgm.StoreGroup.StoreGroupId == storeGroup.StoreGroupId && sgm.IsMember == isMember && sgm.WhereDefined == WhereDefined.Store select sgm; foreach (var subMember in subMembers) { //recursive call bool nonMemberType; if (isMember) { if (subMember.IsMember == false) nonMemberType = false; else nonMemberType = true; } else { if (subMember.IsMember == false) nonMemberType = true; else nonMemberType = false; } var subMembersResult = this.getStoreGroupSidMembers(store, nonMemberType, subMember.SID); result = result.Union(subMembersResult); } return result; } else if (storeGroup.GroupType == GroupType.LDapQuery && isMember == true) { return this.getCachedLDAPQueryResults(storeGroup); } else { //Empty result return result; } }
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 storeApplicationItemValidation(string storeName, string applicationName, out IAzManStore store, out IAzManApplication application, out IEnumerable<IAzManItem> allItems) { itemResultCache = new Hashtable(); attributesResultCache = new Hashtable(); storeName = storeName.Trim(); applicationName = applicationName.Trim(); store = (from s in this.storage.Stores.Values where String.Equals(s.Name, storeName, StringComparison.OrdinalIgnoreCase) select s).FirstOrDefault(); if (store == null) throw SqlAzManException.StoreNotFoundException(storeName, null); application = (from a in store.Applications.Values where String.Equals(a.Name, applicationName, StringComparison.OrdinalIgnoreCase) select a).FirstOrDefault(); if (application == null) throw SqlAzManException.ApplicationNotFoundException(applicationName, store, null); allItems = from t in application.Items.Values select t; }
void SqlAzManENS_StoreOpened(IAzManStore store) { //logging.WriteInfo(this, String.Format("ENS Event: {0}\r\n\r\nStore: {1}\r\n\r\n", "StoreOpened", store.ToString())); }
private static void addParameter(SqlAzManException ex, IAzManStore store) { addParameter(ex, "Store name", store.Name); }
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 IAzManStoreGroup != null) { this.storeGroup = this.Session["selectedObject"] as IAzManStoreGroup; this.Session["storeGroup"] = this.storeGroup; this.Session["store"] = this.storeGroup.Store; } this.Text = "Store Group properties" + (this.storeGroup != null ? ": " + this.storeGroup.Name : String.Empty); this.Description = "Store Group properties"; this.Title = this.Text; if (!Page.IsPostBack) { this.MembersToAdd = new GenericMemberCollection(); this.MembersToRemove = new GenericMemberCollection(); this.NonMembersToAdd = new GenericMemberCollection(); this.NonMembersToRemove = new GenericMemberCollection(); this.lsvMembers = new ListView(); this.lsvNonMembers = new ListView(); this.mnuTab.Items[1].Selected = true; //0 is blank this.mnuTab_MenuItemClick(this, new System.Web.UI.WebControls.MenuEventArgs(this.mnuTab.Items[1])); this.txtName.Text = this.storeGroup.Name; this.txtDescription.Text = this.storeGroup.Description; this.txtGroupType.Text = (this.storeGroup.GroupType == GroupType.Basic ? "Basic group" : "LDAP Query group"); if (this.storeGroup.GroupType == GroupType.Basic) { this.btnMembersAddStoreGroup.Enabled = this.btnNonMembersAddStoreGroup.Enabled = this.storeGroup.Store.HasStoreGroups(); this.mnuTab.Items.RemoveAt(3); this.mnuTab.Items.RemoveAt(2); this.lsvMembers.Items.Clear(); this.lsvNonMembers.Items.Clear(); this.setImage("StoreApplicationGroup_32x32.gif"); } else { this.mnuTab.Items.RemoveAt(7); this.mnuTab.Items.RemoveAt(6); this.mnuTab.Items.RemoveAt(5); this.mnuTab.Items.RemoveAt(4); this.setImage("WindowsQueryLDAPGroup_32x32.gif"); } this.RefreshStoreGroupProperties(); this.saveSessionVariables(); this.modified = false; this.txtName.Focus(); } else { this.loadSessionVariables(); if (this.Session["selectedStoreGroups"] != null) { if (this.mnuTab.SelectedValue == "Members") this.btnMembersAddStoreGroups_Click(this, EventArgs.Empty); else if (this.mnuTab.SelectedValue == "Non Members") this.btnNonMembersAddStoreGroup_Click(this, EventArgs.Empty); } if (this.Session["selectedDBUsers"] != null) { if (this.mnuTab.SelectedValue == "Members") this.btnMembersAddDBUsers_Click(this, EventArgs.Empty); else if (this.mnuTab.SelectedValue == "Non Members") this.btnNonMembersAddDBUsers_Click(this, EventArgs.Empty); } if (this.Session["selectedADObjects"] != null) { if (this.mnuTab.SelectedValue == "Members") this.btnMembersAddWindowsUsersAndGroups_Click(this, EventArgs.Empty); else if (this.mnuTab.SelectedValue == "Non Members") this.btnNonMembersAddWindowsUsersAndGroup_Click(this, EventArgs.Empty); } } }
internal static SqlAzManException ApplicationNotFoundException(string applicationName, IAzManStore store, Exception innerException) { SqlAzManException ex = new SqlAzManException(String.Format("Application '{0}' not found. Store '{1}'.", applicationName, store.Name), innerException); addParameter(ex, "Application name", applicationName); addParameter(ex, store); return ex; }
internal static SqlAzManException AttributeDuplicateException(string attributeKey, IAzManStore store, Exception innerException) { SqlAzManException ex = new SqlAzManException(String.Format("An Attribute with the same key name already exists: '{0}'. Store '{1}'.", attributeKey, store.Name), innerException); addParameter(ex, "Attribute key", attributeKey); addParameter(ex, store); return ex; }