cnpm / cnpmjs.org

@@ -697,6 +697,7 @@
Loading
697 697
}
698 698
699 699
function* _saveNpmUser(username) {
700 +
  var user = yield npmSerivce.getUser(username);
700 701
  if (!user) {
701 702
    var existsUser = yield User.findByName(username);
702 703
    if (existsUser && existsUser.isNpmUser) {

@@ -102,21 +102,30 @@
Loading
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%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading