Example #1
0
        /// <summary>
        /// tells if the user has the given permission to the given table
        /// </summary>
        /// <param name="APermission"></param>
        /// <param name="ADBTable"></param>
        /// <returns></returns>
        public Boolean IsTableAccessOK(TTableAccessPermission APermission, String ADBTable)
        {
            Boolean ReturnValue;
            SUserTableAccessPermissionRow FoundTableRow;

            DataRow[] FoundDataRows = FUserTableAccessPermissionDT.Select(
                SUserTableAccessPermissionTable.GetTableNameDBName() + " = '" + ADBTable + "'");

            if (FoundDataRows.Length != 0)
            {
                ReturnValue   = true;
                FoundTableRow = (SUserTableAccessPermissionRow)FoundDataRows[0];

                switch (APermission)
                {
                case TTableAccessPermission.tapINQUIRE:

                    if (!FoundTableRow.CanInquire)
                    {
                        ReturnValue = false;
                    }

                    break;

                case TTableAccessPermission.tapMODIFY:

                    if (!FoundTableRow.CanModify)
                    {
                        ReturnValue = false;
                    }

                    break;

                case TTableAccessPermission.tapCREATE:

                    if (!FoundTableRow.CanCreate)
                    {
                        ReturnValue = false;
                    }

                    break;

                case TTableAccessPermission.tapDELETE:

                    if (!FoundTableRow.CanDelete)
                    {
                        ReturnValue = false;
                    }

                    break;
                }
            }
            else
            {
                ReturnValue = false;
            }

            return(ReturnValue);
        }
        /// <summary>
        /// tells if the user has the given permission to the given table
        /// </summary>
        /// <param name="APermission"></param>
        /// <param name="ADBTable"></param>
        /// <returns></returns>
        public Boolean IsTableAccessOK(TTableAccessPermission APermission, String ADBTable)
        {
            Boolean ReturnValue;
            SUserTableAccessPermissionRow FoundTableRow;

            DataRow[] FoundDataRows = FUserTableAccessPermissionDT.Select(
                SUserTableAccessPermissionTable.GetTableNameDBName() + " = '" + ADBTable + "'");

            if (FoundDataRows.Length != 0)
            {
                ReturnValue = true;
                FoundTableRow = (SUserTableAccessPermissionRow)FoundDataRows[0];

                switch (APermission)
                {
                    case TTableAccessPermission.tapINQUIRE:

                        if (!FoundTableRow.CanInquire)
                        {
                            ReturnValue = false;
                        }

                        break;

                    case TTableAccessPermission.tapMODIFY:

                        if (!FoundTableRow.CanModify)
                        {
                            ReturnValue = false;
                        }

                        break;

                    case TTableAccessPermission.tapCREATE:

                        if (!FoundTableRow.CanCreate)
                        {
                            ReturnValue = false;
                        }

                        break;

                    case TTableAccessPermission.tapDELETE:

                        if (!FoundTableRow.CanDelete)
                        {
                            ReturnValue = false;
                        }

                        break;
                }
            }
            else
            {
                ReturnValue = false;
            }

            return ReturnValue;
        }