예제 #1
0
        /// <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();
        }
예제 #2
0
 /// <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);
 }
예제 #3
0
        /// <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);
        }
예제 #4
0
        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();
        }
예제 #5
0
 /// <summary>
 /// Removes the specified item.
 /// </summary>
 /// <param name="item">The item.</param>
 public void Remove(ReportAccessControlEntry item)
 {
     this.List.Remove(item);
 }
예제 #6
0
 /// <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);
 }
예제 #7
0
        /// <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;
        }
예제 #8
0
 /// <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;
 }
예제 #9
0
 /// <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));
 }
예제 #10
0
 /// <summary>
 /// Removes the specified item.
 /// </summary>
 /// <param name="item">The item.</param>
 public void Remove(ReportAccessControlEntry item)
 {
     this.List.Remove(item);
 }