|
|
@@ -59,7 +59,7 @@ class Blih {
|
|
59
|
59
|
}
|
|
60
|
60
|
|
|
61
|
61
|
token_calc() {
|
|
62
|
|
- return crypto.createHash('sha512').update(prompt(`${this._user}'s password: `, {echo: '*'}) || process.exit(1)).digest('hex');
|
|
|
62
|
+ return crypto.createHash('sha512').update(prompt(`${this._user}'s password: `, {echo: ''}) || process.exit(1)).digest('hex');
|
|
63
|
63
|
}
|
|
64
|
64
|
}
|
|
65
|
65
|
|
|
|
@@ -81,15 +81,15 @@ class Repository extends Subcommand {
|
|
81
|
81
|
Usage: ${process.argv[1]} [options] repository command ...
|
|
82
|
82
|
|
|
83
|
83
|
Commands:
|
|
84
|
|
- create repo\t\tCreate a repository named "repo"
|
|
85
|
|
- info repo\t\t\tGet the repository metadata
|
|
86
|
|
- getacl repo\t\tGet the acls set for the repository
|
|
87
|
|
- list\t\t\tList the repositories created
|
|
88
|
|
- setacl repo user [acl]\tSet (or remove) an acl for "user" on "repo"
|
|
89
|
|
- \t\t\t\tACL format:
|
|
90
|
|
- \t\t\t\t\tr for read
|
|
91
|
|
- \t\t\t\t\tw for write
|
|
92
|
|
- \t\t\t\t\ta for admin
|
|
|
84
|
+ create repo\t\t\tCreate a repository named "repo"
|
|
|
85
|
+ info repo\t\t\t\tGet the repository metadata
|
|
|
86
|
+ getacl repo\t\t\tGet the acls set for the repository
|
|
|
87
|
+ list\t\t\t\tList the repositories created
|
|
|
88
|
+ setacl repo user [user...] [acl]\tSet (or remove) an acl for each "user" on "repo"
|
|
|
89
|
+ \t\t\t\t\tACL format:
|
|
|
90
|
+ \t\t\t\t\t\tr for read
|
|
|
91
|
+ \t\t\t\t\t\tw for write
|
|
|
92
|
+ \t\t\t\t\t\ta for admin
|
|
93
|
93
|
`;
|
|
94
|
94
|
this.usage_message = '\n ' + this.usage_message.substr(3).replace(/\n\t\t/g, '\n ');
|
|
95
|
95
|
}
|
|
|
@@ -138,10 +138,18 @@ class Repository extends Subcommand {
|
|
138
|
138
|
if (params.length < 2)
|
|
139
|
139
|
return this.usage();
|
|
140
|
140
|
const blih = new Blih(this.options);
|
|
141
|
|
- blih.request({ path: `/repository/${params[0]}/acls`, method:'POST', data: {
|
|
142
|
|
- user: params[1],
|
|
143
|
|
- acl: params[2] || ''
|
|
144
|
|
- }});
|
|
|
141
|
+ const repo = params.shift();
|
|
|
142
|
+ const rights = params.pop();
|
|
|
143
|
+ var users = params;
|
|
|
144
|
+ for (let user of users) {
|
|
|
145
|
+ blih.request({
|
|
|
146
|
+ path: `/repository/${repo}/acls`,
|
|
|
147
|
+ method:'POST', data: {
|
|
|
148
|
+ user: user,
|
|
|
149
|
+ acl: rights || ''
|
|
|
150
|
+ }
|
|
|
151
|
+ });
|
|
|
152
|
+ }
|
|
145
|
153
|
}
|
|
146
|
154
|
|
|
147
|
155
|
getacl(params) {
|