Skip to content

Commit

Permalink
Revert "Adopt eslint's no-prototype-builtins rule."
Browse files Browse the repository at this point in the history
This reverts commit b184a93.

This broke LDAP, causing errors like:

```
Exception while invoking method 'login' TypeError: hasOwnProperty is not a function
    at LDAP.ldapCheck (imports/server/accounts/ldap.js:49:8)
    at MethodInvocation.<anonymous> (imports/server/accounts/ldap/ldap-server.js:25:30)
    at packages/accounts-base/accounts_server.js:462:31
    at tryLoginMethod (packages/accounts-base/accounts_server.js:1291:14)
    at AccountsServer._runLoginHandlers (packages/accounts-base/accounts_server.js:460:22)
    at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:520:31)
    at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1771:12)
    at packages/ddp-server/livedata_server.js:719:19
    at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
    at packages/ddp-server/livedata_server.js:717:46
    at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
    at packages/ddp-server/livedata_server.js:715:46
    at new Promise (<anonymous>)
    at Session.method (packages/ddp-server/livedata_server.js:689:23)
    at packages/ddp-server/livedata_server.js:559:43
```
  • Loading branch information
kentonv committed Apr 11, 2020
1 parent 4c29e78 commit 932214a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions shell/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ rules:
no-unused-vars: ["off"]
no-empty: ["off"]
no-inner-declarations: ["off"]
no-prototype-builtins: ["off"]
10 changes: 4 additions & 6 deletions shell/imports/server/accounts/ldap.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ LDAP.prototype.ldapCheck = function (db, options) {

options = options || {};

const hasOwnProperty = Object.prototype.hasOwnProperty.call

if ((hasOwnProperty(options, "username") && hasOwnProperty(options, "ldapPass")) ||
hasOwnProperty(options, "searchUsername")) {
if ((options.hasOwnProperty("username") && options.hasOwnProperty("ldapPass")) ||
options.hasOwnProperty("searchUsername")) {
_this.options.base = db.getLdapBase();
_this.options.url = db.getLdapUrl();
_this.options.searchBeforeBind = {};
Expand Down Expand Up @@ -96,7 +94,7 @@ LDAP.prototype.ldapCheck = function (db, options) {
let username = options.username;
let domain = _this.options.defaultDomain;

if (!hasOwnProperty(options, "searchUsername")) {
if (!options.hasOwnProperty("searchUsername")) {
// Slide @xyz.whatever from username if it was passed in
// and replace it with the domain specified in defaults
let emailSliceIndex = options.username.indexOf("@");
Expand Down Expand Up @@ -167,7 +165,7 @@ LDAP.prototype.ldapCheck = function (db, options) {

retObject.searchResults = _.omit(entry.object, "userPassword");

if (hasOwnProperty(options, "searchUsername")) {
if (options.hasOwnProperty("searchUsername")) {
// This was only a search, return immediately
resolved = true;
ldapAsyncFut.return(retObject);
Expand Down
2 changes: 1 addition & 1 deletion shell/imports/server/accounts/saml-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ SAML.prototype.validateResponse = function (samlResponse, callback) {
const conditions = _this.getElement(assertion[0], "Conditions")[0];
if (conditions) {
for (const key in conditions) {
if (Object.prototype.hasOwnProperty.call(conditions, key)) {
if (conditions.hasOwnProperty(key)) {
const value = conditions[key];
if (key === "$") {
const nowMs = Date.now();
Expand Down
2 changes: 1 addition & 1 deletion shell/imports/server/shell-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ Meteor.publish("referralInfoPseudo", function () {
// If the handle doesn't show up in the new list of referredAccountIds, then remove
// info from the client & stop it on the server & make it null.
const handleForProfileName = handleForProfileNameByAccountId[accountId];
if (Object.prototype.hasOwnProperty.call(referredAccountIdsAsObject, accountId)) {
if (referredAccountIdsAsObject.hasOwnProperty(accountId)) {
stopWatchingAccount(accountId);
}
});
Expand Down

0 comments on commit 932214a

Please sign in to comment.