- fix: new publish with token should add user to maintainers
ci: use github
fix: fix _saveNpmUser
- ci: github add mysql service
102 | 102 | // notice that admins can not publish to all modules |
|
103 | 103 | // (but admins can add self to maintainers first) |
|
104 | 104 | ||
105 | + | var m = maintainers.filter(function (maintainer) { |
|
106 | + | return maintainer.name === username; |
|
107 | + | }); |
|
108 | + | ||
109 | + | // package.json has maintainers and publisher in not in the list |
|
110 | + | if (authorizeType === common.AuthorizeType.BEARER && m.length === 0) { |
|
111 | + | var publisher = { |
|
112 | + | name: this.user.name, |
|
113 | + | email: this.user.email, |
|
114 | + | }; |
|
115 | + | m = [ publisher ]; |
|
116 | + | maintainers.push(publisher); |
|
117 | + | } |
|
118 | + | ||
105 | 119 | // make sure user in auth is in maintainers |
|
106 | 120 | // should never happened in normal request |
|
107 | - | if (authorizeType !== common.AuthorizeType.BEARER) { |
|
108 | - | var m = maintainers.filter(function (maintainer) { |
|
109 | - | return maintainer.name === username; |
|
110 | - | }); |
|
111 | - | if (m.length === 0) { |
|
112 | - | this.status = 403; |
|
113 | - | const error = '[maintainers_error] ' + username + ' does not in maintainer list'; |
|
114 | - | this.body = { |
|
115 | - | error, |
|
116 | - | reason: error, |
|
117 | - | }; |
|
118 | - | return; |
|
119 | - | } |
|
121 | + | if (m.length === 0) { |
|
122 | + | this.status = 403; |
|
123 | + | const error = '[maintainers_error] ' + username + ' does not in maintainer list'; |
|
124 | + | this.body = { |
|
125 | + | error, |
|
126 | + | reason: error, |
|
127 | + | }; |
|
128 | + | return; |
|
120 | 129 | } |
|
121 | 130 | ||
122 | 131 | // TODO: add this info into some table |
Files | Coverage |
---|---|
common | 66.67% |
controllers | 85.42% |
middleware | 94.34% |
models | 90.42% |
routes | 100.00% |
servers | 90.91% |
services | 90.82% |
sync | 89.61% |
config/index.js | 75.51% |
lib/common.js | 89.19% |
Project Totals (97 files) | 87.31% |