/// <summary> /// Initializes a new instance of the <see cref="ReportAccessControList"/> class. /// </summary> /// <param name="reader">The reader.</param> internal ReportAccessControList(IDataReader reader) { bool bFirstRun = true; while (reader.Read()) { if (bFirstRun) { _id = (int)reader["AclId"]; _ownerReportId = (int)reader["ReportId"]; bFirstRun = false; } if (reader["AceId"] != DBNull.Value) { this.Add(ReportAccessControlEntry.InternalCreate((int)reader["AceId"], (string)SqlHelper.DBNull2Null(reader["role"]), (int)SqlHelper.DBNull2Null(reader["principalId"], 0), (string)SqlHelper.DBNull2Null(reader["action"]), (bool)SqlHelper.DBNull2Null(reader["allow"]), false)); } } Reset(); }
/// <summary> /// Adds the specified item. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> public int Add(ReportAccessControlEntry item) { // Check item originality if (!CheckAceOriginality(item)) { return(this.List.Add(item)); } return(-1); }
/// <summary> /// Checks the ace originality. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> public bool CheckAceOriginality(ReportAccessControlEntry item) { foreach (ReportAccessControlEntry ace in this) { if (!ace.IsInternal && ace.PrincipalId == item.PrincipalId && ace.Role == item.Role && ace.Action == item.Action && ace.Allow == item.Allow) { return(true); } } return(false); }
protected void btnAdd_Click(object sender, System.EventArgs e) { ReportAccessControList ACLr = (ReportAccessControList)ViewState["ACL"]; ReportAccessControlEntry ACEr; if(ddGroups.SelectedValue=="0") ACEr = new ReportAccessControlEntry(ddUsers.SelectedValue, "Read", (rbList.SelectedValue=="0")); else { int iPrincipalId = (ddUsers.SelectedValue=="0")? int.Parse(ddGroups.SelectedValue) : int.Parse(ddUsers.SelectedValue); ACEr = new ReportAccessControlEntry(iPrincipalId, "Read", (rbList.SelectedValue=="0")); } ACLr.Add(ACEr); ViewState["ACL"] = ACLr; ListItem _li = ddGroups.SelectedItem; if (_li!=null) BindUsers(int.Parse(_li.Value)); BinddgMembers(); }
/// <summary> /// Removes the specified item. /// </summary> /// <param name="item">The item.</param> public void Remove(ReportAccessControlEntry item) { this.List.Remove(item); }
/// <summary> /// Determines whether [contains] [the specified item]. /// </summary> /// <param name="item">The item.</param> /// <returns> /// <c>true</c> if [contains] [the specified item]; otherwise, <c>false</c>. /// </returns> public bool Contains(ReportAccessControlEntry item) { return this.List.Contains(item); }
/// <summary> /// Checks the ace originality. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> public bool CheckAceOriginality(ReportAccessControlEntry item) { foreach(ReportAccessControlEntry ace in this) { if(!ace.IsInternal&& ace.PrincipalId==item.PrincipalId&& ace.Role==item.Role&& ace.Action==item.Action&& ace.Allow==item.Allow) { return true; } } return false; }
/// <summary> /// Adds the specified item. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> public int Add(ReportAccessControlEntry item) { // Check item originality if(!CheckAceOriginality(item)) return this.List.Add(item); return -1; }
/// <summary> /// Determines whether [contains] [the specified item]. /// </summary> /// <param name="item">The item.</param> /// <returns> /// <c>true</c> if [contains] [the specified item]; otherwise, <c>false</c>. /// </returns> public bool Contains(ReportAccessControlEntry item) { return(this.List.Contains(item)); }