Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/833#discussion_r96420591
--- Diff: app/core/auth.js ---
@@ -11,50 +11,30 @@
// the License.
import FauxtonAPI from "./base";
-import Backbone from "backbone";
-import _ from "lodash";
-// This is not exposed externally as it should not need to be accessed or
overridden
-var Auth = function (options) {
- this._options = options;
- this.initialize.apply(this, arguments);
-};
-
-// Piggy-back on Backbone's self-propagating extend function,
-Auth.extend = Backbone.Model.extend;
-
-_.extend(Auth.prototype, Backbone.Events, {
- authDeniedCb: function () {},
-
- initialize: function () {
- },
-
- authHandlerCb : function () {
- var deferred = $.Deferred();
- deferred.resolve();
- return deferred;
- },
-
- registerAuth: function (authHandlerCb) {
- this.authHandlerCb = authHandlerCb;
- },
-
- registerAuthDenied: function (authDeniedCb) {
- this.authDeniedCb = authDeniedCb;
- },
+function authenticate(session, roles) {
+ if (session.isAdminParty()) {
+ return session.trigger('authenticated');
+ } else if (session.matchesRoles(roles)) {
+ return session.trigger('authenticated');
+ } else {
+ throw new Error('Unable to authentacte');
+ }
+}
- checkAccess: function (roles) {
- var requiredRoles = roles || [],
- that = this;
+function authenticatoinDenied() {
+ let url = window.location.hash
--- End diff --
nice idea here. Could you make this a `const`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---