mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(commander) changeUIDToName
This commit is contained in:
parent
545947d4e7
commit
db889f9fa4
1 changed files with 18 additions and 21 deletions
|
|
@ -152,34 +152,31 @@
|
|||
|
||||
json.files = changeOrder(files);
|
||||
|
||||
changeUIDToName(json, function() {
|
||||
Util.exec(p.callback, null, json);
|
||||
changeUIDToName(json, function(error) {
|
||||
p.callback(error, json);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function changeUIDToName(json, callback) {
|
||||
Util.exec.if(WIN32, callback,
|
||||
function(callback) {
|
||||
users.getNames(function(error, names) {
|
||||
var i, n, current, owner,
|
||||
files = json.files;
|
||||
if (WIN32)
|
||||
callback();
|
||||
else
|
||||
users.getNames(function(error, names) {
|
||||
var files = json.files;
|
||||
|
||||
if (error)
|
||||
callback(error);
|
||||
else
|
||||
files.forEach(function(file) {
|
||||
var owner = file.owner;
|
||||
owner = names[owner];
|
||||
|
||||
Util.log(error);
|
||||
|
||||
n = files.length;
|
||||
for (i = 0; i < n; i++) {
|
||||
current = files[i];
|
||||
|
||||
owner = current.owner;
|
||||
owner = names[owner];
|
||||
|
||||
if (owner)
|
||||
current.owner = owner;
|
||||
}
|
||||
|
||||
Util.exec(callback);
|
||||
});
|
||||
file.owner = owner;
|
||||
});
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue