Esempio n. 1
0
        public override bool CheckPermission(TablePermission permission)
        {
            string query         = @"SELECT COUNT(1) FROM USER_TAB_PRIVS WHERE TABLE_BAME = @tableName AND PRIVILEGE = @permission";
            var    permissionCmd = new OracleCommand(query);

            permissionCmd.Parameters.Add(new OracleParameter()
            {
                ParameterName = "@tableName", Value = permission.TableName
            });
            permissionCmd.Parameters.Add(new OracleParameter()
            {
                ParameterName = "@permission", Value = permission.Permission.ToString()
            });

            permissionCmd.Connection = _dbConnection as OracleConnection;

            var reader = permissionCmd.ExecuteReader();

            reader.Read();

            bool result = (int)reader[0] == 1;

            reader.Close();

            return(result);
        }
Esempio n. 2
0
        public override bool CheckPermission(TablePermission permission)
        {
            string query         = @"SELECT HAS_PERMS_BY_NAME (@tableName, 'OBJECT', @permission)";
            var    permissionCmd = new SqlCommand(query);

            permissionCmd.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@tableName", Value = permission.TableName
            });
            permissionCmd.Parameters.Add(new SqlParameter()
            {
                ParameterName = "@permission", Value = permission.Permission.ToString()
            });

            permissionCmd.Connection = _dbConnection as SqlConnection;

            var reader = permissionCmd.ExecuteReader();

            reader.Read();

            bool result = (int)reader[0] == 1;

            reader.Close();

            return(result);
        }
Esempio n. 3
0
 public abstract bool CheckPermission(TablePermission permission);