diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/explorer.js b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/explorer.js index 6917b70d545..490c3934adb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/explorer.js +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/explorer.js @@ -416,9 +416,38 @@ $(this).prop('disabled', true); $(this).button('complete'); + // Get umask from the configuration + var umask, oldUmask, actualUmask; + + $.ajax({'url': '/conf', 'dataType': 'xml', 'async': false}).done( + function(d) { + var $xml = $(d); + $xml.find('property').each(function(idx,v) { + // Current umask config + if ($(v).find('name').text() === 'fs.permissions.umask-mode') { + umask = $(v).find('value').text(); + } + + // Deprecated umask config + if ($(v).find('name').text() === 'dfs.umask') { + oldUmask = $(v).find('value').text(); + } + }); + }); + var url = '/webhdfs/v1' + encode_path(append_path(current_directory, $('#new_directory').val())) + '?op=MKDIRS'; + if (oldUmask) { + actualUmask = 777 - oldUmask; + } else if (umask) { + actualUmask = 777 - umask; + } + + if (actualUmask) { + url = url + '&permission=' + actualUmask; + } + $.ajax(url, { type: 'PUT' } ).done(function(data) { browse_directory(current_directory); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js index cc555670b22..cbf9df99567 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js @@ -416,9 +416,38 @@ $(this).prop('disabled', true); $(this).button('complete'); + // Get umask from the configuration + var umask, oldUmask, actualUmask; + + $.ajax({'url': '/conf', 'dataType': 'xml', 'async': false}).done( + function(d) { + var $xml = $(d); + $xml.find('property').each(function(idx,v) { + // Current umask config + if ($(v).find('name').text() === 'fs.permissions.umask-mode') { + umask = $(v).find('value').text(); + } + + // Deprecated umask config + if ($(v).find('name').text() === 'dfs.umask') { + oldUmask = $(v).find('value').text(); + } + }); + }); + var url = '/webhdfs/v1' + encode_path(append_path(current_directory, $('#new_directory').val())) + '?op=MKDIRS'; + if (oldUmask) { + actualUmask = 777 - oldUmask; + } else if (umask) { + actualUmask = 777 - umask; + } + + if (actualUmask) { + url = url + '&permission=' + actualUmask; + } + $.ajax(url, { type: 'PUT' } ).done(function(data) { browse_directory(current_directory);