Constructor to create permission validator object
@param req {Object} request object
@param permissionSchemaKey {String}
@param modelName {String}
@constructor
350888
function PermissionValidator(req, permissionSchemaKey, modelName) {
    if (arguments.length != 3) {
        throw new Error("Invalid no of arguments");
    }

    var userRoles = req.session.roles;

    var isValidModelId = function (modelId) {
        return _.isNumber(modelId);
    };

    /**
     * Returns permission error object for the action
     * @param action {String}
     * @returns {PermissionError}
     */
    var getPermissionError = this.getPermissionError = function (action) {
        return new PermissionError(null, req.session.user.userName, action)
    };

    /**
     * Returns validation result object
     * This object has following keys:
     *      isAuthorized {Boolean}: whether action is authorized
     *      roleId {Number}: Role for which action is validated
     *      action {String}: Action for which permissions are checked
     *
     * @param action {String}
     * @returns {Object}
     */
    function hasPermission1(action) {
        var cacheItem = getCacheItem(permissionSchemaKey);
        var p = checkPermissionSync(action, userRoles, cacheItem);
        /*if (p.isAuthorized === false) {
         throw new PermissionError(null, req.session.user.userName, action);
         }*/
        return  p;
    };

    /**
     * Method useful when model id is not present to assess permissions.
     * Case in which modelName is also not provided, when creating PermissionValidator instance
     *
     * @param action {String}
     * @param next {Function} - Callback will have err & permission result obj as parameters
     */
    this.hasPermissionWithoutModelId = function (action, next) {
        var that = this;
        if (!action || !_.isString(action) || !_.isFunction(next)) {
            throw new Error("Missing arguments.")
        }
        var err;
        var p = hasPermission1(action);
        if (p.isAuthorized === false) {
            err = getPermissionError(action);
        }
        next(err, p);
    };

    /**
     * Method useful to validate multiple permission actions in a single request
     * @param actions {Array} Multiple can be passed
     * @param modelId {Number}
     * @param next {Function} callback. parameter passed: err, object having each
     * permission action result
     */
    this.checkPermissionForActions = function (actions, modelId, next) {
        var that = this, perm = {};
        modelId = parseInt(modelId);
        if (!isValidModelId(modelId)) {
            throw new Error("Invalid model id: " + modelId + " :: modelName: " + modelName);
        }

        async.series([
            function (n) {
                Cache.storeByModelId(req.app.set("db"), permissionSchemaKey, modelName, modelId, n);
            } ,
            function (n) {
                var cacheItem = Cache.getCacheItem(permissionSchemaKey, modelId);

                if (cacheItem) {
                    actions.forEach(function (action) {
                        perm[action] = checkPermissionSync(action, userRoles, cacheItem);
                    });
                }
                else {
                    _l("No permissions exists in cache. Pass the callback to hasPermission");
                }
                n();
            }
        ], function (err, result) {
            next(err, !err ? perm : null);
        });
    };

    /**
     * Method check permissions in both sync and async way (if callback is provided)
     * if only action is provided than model permissions is checked (like ADD) but if modelId is also given then
     * model entry permission is checked(like VIEW, can be different for each model entry)
     *
     * @param action {String}
     * @param modelId {Number}
     * @param next {Function}
     * @returns {Object}
     */
    this.hasPermission = function (action, modelId, next) {
        var that = this;
        if (!action || !modelId || !_.isString(action) || !_.isFunction(next)) {
            throw new Error("Missing arguments.")
        }

        modelId = parseInt(modelId);
        if (!isValidModelId(modelId)) {
            throw new Error("Invalid model id: " + modelId + " :: modelName: " + modelName);
        }

        var process = function () {
            var cacheItem = Cache.getCacheItem(permissionSchemaKey, modelId);

            if (cacheItem) {
                return checkPermissionSync(action, userRoles, cacheItem);
            }
            else {
                _l("No permissions exists in cache. Pass the callback to hasPermission");
            }
            return;
        };

        Cache.storeByModelId(req.app.set("db"), permissionSchemaKey, modelName, modelId, function (err, done) {
            if (err) {
                return next(err);
            }
            var p;
            if (done) {
                p = process();
                if (p.isAuthorized === false) {
                    err = getPermissionError(action);
                }
            }
            next(err, p);
        });
    }
}
1110674
function (modelName) {
      if (["make", "list"].indexOf(modelName) === -1) {
        throw new Error(
          "checkOwnerApp middleware can only be configured with 'make' or 'list'. You passed in: '" +
          modelName +
          "'"
        );
      }

      return function (req, res, next) {
        // Don't enforce write permissions if not enabled.
        if (!ENFORCE_WRITE_PERMISSIONS) {
          return next();
        }

        var model = req[modelName],
          user = req.credentials.user;
        // check if the authenticated application has admin permissions, or if it owns the make
        if (req.credentials.admin !== true && user !== model.ownerApp) {
          return hawkModule.respond(403, res, req.credentials, req.artifacts, {
            status: "failure",
            reason: "unauthorized"
          }, "application/json");
        }
        next();
      };
    }
1293329
private ModelAndView getUserApprovalPageResponse(Map<String, Object> model,
                                                     AuthorizationRequest authorizationRequest, Authentication principal) {
        logger.debug("Loading user approval page: " + userApprovalPage);
        model.putAll(userApprovalHandler.getUserApprovalRequest(authorizationRequest, principal));
        return new ModelAndView(userApprovalPage, model);
    }
992806
def has_add_permission(self, request):
        
        perm_string = '%s.add_%s' % (self.model._meta.app_label,
            self.model._meta.object_name.lower()
        )
        return request.user.has_perm(perm_string)
562432
function generateSchemaRaw(modelParam, opts = {}) {
  validate.notNil(modelParam, "modelParam is mandatory");

  let models;
  if (_.isArray(modelParam)) {
    models = modelParam;
  } else if (_.isObject(modelParam)) {
    models = [modelParam];
  } else {
    throw new Error("modelParam should be an object or an array of objects");
  }

  return models.map(model => {
    const processedSchema = modelTransformer.transformJsonSchemaFromModel(
      model,
      opts
    );

    return {
      name: model.name,
      schema: processedSchema
    };
  });
}
255739
def validate_permission(self, key, permission):
        
        if permission.perm_name not in self.__possible_permissions__:
            raise AssertionError(
                "perm_name is not one of {}".format(self.__possible_permissions__)
            )
        return permission
906332
public Permission createPermissionObject(String permissionClass, String target, String action, String credential, String principalType, String principalName, String fileName) {
        Permission permission = null;
        if ((target != null) && (target.equals("ALL FILES") || target.contains("ALL FILES"))) {
            target = "<<ALL FILES>>";
        }
        try {
            if (permissionClass != null && !permissionClass.equalsIgnoreCase("null")) {
                // If this is a PrivateCredentialPermission
                if (permissionClass.equalsIgnoreCase("javax.security.auth.PrivateCredentialPermission")) {
                    if (target == null || target.equalsIgnoreCase("null")) {
                        // Create target from the credential and principal details
                        StringBuilder targetString = new StringBuilder();
                        targetString.append(credential);
                        targetString.append(" ");
                        targetString.append(principalType);
                        targetString.append(" \"");
                        targetString.append(principalName);
                        targetString.append("\"");

                        permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class, String.class).newInstance(targetString.toString(), "read");
                    } else {
                        permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class, String.class).newInstance(target, "read");
                    }
                } else {
                    if (action == null || action.equalsIgnoreCase("null")) {
                        if (target == null || target.equalsIgnoreCase("null")) {
                            permission = (Permission) getPermissionClass(permissionClass).newInstance();
                        } else {
                            permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class).newInstance(target);
                        }
                    } else {
                        permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class, String.class).newInstance(target, action);
                    }
                }
            }
        } catch (Exception e) {
            if (tc.isWarningEnabled()) {
                String rootCause = null;

                if (e.getCause() != null) {
                    rootCause = e.getCause().getClass().getName() + "[" + e.getCause().getMessage() + "]";
                } else if (e.getMessage() != null) {
                    rootCause = e.getClass().getName() + "[" + e.getMessage() + "]";
                }

                if (rootCause == null) {
                    rootCause = "unknown reasons";
                }
                if (e instanceof java.lang.ClassNotFoundException) {
                    Tr.warning(tc, PERMISSION_CLASSNOTFOUND, permissionClass, rootCause, fileName);
                } else {
                    Tr.warning(tc, INCORRECT_PERMISSION_CONFIGURATION, permissionClass, rootCause, fileName);
                }
            }
            if (e instanceof java.lang.ClassNotFoundException) {
                permission = new UnresolvedPermission(permissionClass, target, action, null);
            }
        }

        return permission;
    }
758919
function PermPermissionStore(PermPermission) {
  'ngInject';

  /**
   * @property permissionStore
   *
   * @type {Object}
   */
  var permissionStore = {};

  this.definePermission = definePermission;
  this.defineManyPermissions = defineManyPermissions;
  this.removePermissionDefinition = removePermissionDefinition;
  this.hasPermissionDefinition = hasPermissionDefinition;
  this.getPermissionDefinition = getPermissionDefinition;
  this.getStore = getStore;
  this.clearStore = clearStore;

  /**
   * Allows to define permission on application configuration
   * @methodOf permission.PermPermissionStore
   *
   * @param permissionName {String} Name of defined permission
   * @param validationFunction {Function} Function used to validate if permission is valid
   */
  function definePermission(permissionName, validationFunction) {
    permissionStore[permissionName] = new PermPermission(permissionName, validationFunction);
  }

  /**
   * Allows to define set of permissionNames with shared validation function on application configuration
   * @methodOf permission.PermPermissionStore
   * @throws {TypeError}
   *
   * @param permissionNames {Array<Number>} Set of permission names
   * @param validationFunction {Function} Function used to validate if permission is valid
   */
  function defineManyPermissions(permissionNames, validationFunction) {
    if (!angular.isArray(permissionNames)) {
      throw new TypeError('Parameter "permissionNames" name must be Array');
    }

    angular.forEach(permissionNames, function (permissionName) {
      definePermission(permissionName, validationFunction);
    });
  }

  /**
   * Deletes permission
   * @methodOf permission.PermPermissionStore
   *
   * @param permissionName {String} Name of defined permission
   */
  function removePermissionDefinition(permissionName) {
    delete permissionStore[permissionName];
  }

  /**
   * Checks if permission exists
   * @methodOf permission.PermPermissionStore
   *
   * @param permissionName {String} Name of defined permission
   * @returns {Boolean}
   */
  function hasPermissionDefinition(permissionName) {
    return angular.isDefined(permissionStore[permissionName]);
  }

  /**
   * Returns permission by it's name
   * @methodOf permission.PermPermissionStore
   *
   * @returns {permission.Permission} Permissions definition object
   */
  function getPermissionDefinition(permissionName) {
    return permissionStore[permissionName];
  }

  /**
   * Returns all permissions
   * @methodOf permission.PermPermissionStore
   *
   * @returns {Object} Permissions collection
   */
  function getStore() {
    return permissionStore;
  }

  /**
   * Removes all permissions
   * @methodOf permission.PermPermissionStore
   */
  function clearStore() {
    permissionStore = {};
  }
}
162734
public static <T> void validate(Request<T> request) throws ValidationConstraintViolationException {
		if (request != null) {
			Class<?> clazz = request.getClass();
			List<ConstraintViolation> leafs = new LinkedList<ConstraintViolation>();

			Field[] fields = clazz.getDeclaredFields();
			for (Field field : fields) {
				if (null != field.getAnnotation(Required.class)) {

					field.setAccessible(true);
					Object value = null;
					try {
						value = field.get(request);
					} catch (Exception e) {
						// not cool...
						throw new ValidationConstraintViolationException(e);
					}

					if (value == null || value instanceof String && ((String) value).isEmpty()) {
						ConstraintViolation violation = ConstraintViolation.newConstraintViolation("@" + Required.class.getSimpleName(), field);
						leafs.add(violation);
					}
				}
			}

			if (!leafs.isEmpty()) {
				throw new ValidationConstraintViolationException(preMessage, leafs);
			}
		}
	}
80395
def permission_denied(request, template_name=None, extra_context=None):
    
    if template_name is None:
        template_name = ('403.html', 'authority/403.html')
    context = {
        'request_path': request.path,
    }
    if extra_context:
        context.update(extra_context)
    return HttpResponseForbidden(loader.render_to_string(
        template_name=template_name,
        context=context,
        request=request,
    ))
937931
function initModelCreate (args) {
    var controller = this
    var model = this.model
    // get accountId column
    var accountIdColumn = model.columnName('accountId')
    // set role to authenticated if model requires account id
    var role = args.defaultRole || (accountIdColumn && model.columns[accountIdColumn].null === false ? 'authenticated' : 'all')
    // get relations to create from args if any
    var relations = args.create && args.create.relations
    // validate relations
    _.each(relations, (createArgs, relation) => {
        // this will throw error on invalid relation
        model.relation(relation)
    })
    // index inputs
    var input = {
        // whether or not create data includes meta columns
        meta: 'query.meta',
        // url to redirect to on success
        redirect: ['body.redirect', 'query.redirect'],
    }
    // instance data is in body under model name
    input[model.name] = 'body.'+model.name
    // create path if it does not exist
    if (!this.paths['/']) {
        this.paths['/'] = {}
    }
    // controller spec
    var node = {
        input: input,
        method: function (args) {
            return create(controller, args, node, relations)
        },
        methodName: 'create',
        role: role,
        template: 'instance',
    }
    // add handler for POST / to create instance
    this.paths['/'].post = [node]
}
1240120
def grant_permissions(self, proxy_model):
        
        ContentType = apps.get_model('contenttypes', 'ContentType')
        try:
            Permission = apps.get_model('auth', 'Permission')
        except LookupError:
            return

        # searched_perms will hold the permissions we're looking for as (content_type, (codename, name))
        searched_perms = []
        ctype = ContentType.objects.get_for_model(proxy_model)
        for perm in self.default_permissions:
            searched_perms.append((
                '{0}_{1}'.format(perm, proxy_model._meta.model_name),
                "Can {0} {1}".format(perm, proxy_model._meta.verbose_name_raw)
            ))

        all_perms = set(Permission.objects.filter(
            content_type=ctype,
        ).values_list(
            'content_type', 'codename'
        ))
        permissions = [
            Permission(codename=codename, name=name, content_type=ctype)
            for codename, name in searched_perms if (ctype.pk, codename) not in all_perms
        ]
        Permission.objects.bulk_create(permissions)
340128
function(requiredPermissions) {
      if (requiredPermissions instanceof Array) {
        requiredPermissions = {
          all: requiredPermissions
        }
      } else if (typeof requiredPermissions !== 'object') {
        requiredPermissions = {
          all: [requiredPermissions]
        }
      }

      return function(req, res, next) {
        var user    = req.user
          , method  = req.method.toLowerCase()
          , id      = req.params.id
          , action  = req.params.action || id;

        if (!!id && !!action && action === 'list') {
          action = 'get'
          req.params.action = 'get';
        } else if (!action && method === 'get' && /^\/.*\/(.*\/?)$/ig.test(req.url)) {
          action = 'list';
        } else if (/^[0-9a-fA-F]{24}$/.test(action) || !isNaN(action)) {
          action = 'get';
        } else {
          if (req.params.action) {
            action = req.params.action;
          } else if (method === 'get' && !id) {
            action = 'list';
          } else {
            action = method;
          }
        }

        async.waterfall(
          [

            function determinePermissions(callback) {
              var actionName = (!!action ? action : method) + 'Action'
                , permissions = [];
              
              if (typeof requiredPermissions[actionName] !== 'undefined') {
                if (requiredPermissions[actionName] !== null) {
                  if (requiredPermissions[actionName] instanceof Array) {
                    permissions = permissions.concat(requiredPermissions[actionName]);
                  } else {
                    permissions.push(requiredPermissions[actionName]);
                  }
                }
              } else if (typeof requiredPermissions.all !== 'undefined') {
                if (requiredPermissions.all !== null) {
                  permissions = requiredPermissions.all instanceof Array ? requiredPermissions.all : [requiredPermissions.all];
                }
              }

              callback(null, permissions);
            },

            function userRoleHasPermission(permissions, callback) {
              var hasPermission = true;

              if (!!permissions.length && !req.isAuthenticated()) {
                return callback('User is not authenticated!');
              }

              permissions.every(function(requiredPermission) {
                if (/^([^\$]+)\.\$action/.test(requiredPermission)) {
                  requiredPermission = RegExp.$1 + '.';

                  switch(action) {
                  
                  case 'get':
                    requiredPermission += 'view';
                    break;
                  case 'post':
                    requiredPermission += 'create';
                    break;
                  case 'put':
                    requiredPermission += 'edit';
                    break;
                  default:
                    requiredPermission += action;
                    break;
                  }
                }

                if (requiredPermission !== 'requiresLogin' && _.findWhere([].slice.call(user.Role.Permissions), { action: requiredPermission }) === undefined) {
                  callback('Logged in user does not have ' + requiredPermission + ' permission.');
                  hasPermission = false;
                  return false;
                }
                return true;
              });

              if (!!hasPermission) {
                callback(null);
              }
            }
          ],
          function(err) {
            if (err === null) {
              next();
            } else {
              console.dir(err);
              res.send(401, { statusCode: 401, message: err });
            }
          }

       );
      }
    }
267788
def to_s
      t('permission_string', action: t(self.permission_type.to_s),
        model: t(self.model.underscore.humanize))
    end
675435
function(objects, user, action, model, body) {
    if (!_.isArray(objects)) {
      return PermissionService.isAllowedToPerformSingle(user.id, action, model, body)(objects);
    }
    return Promise.all(objects.map(PermissionService.isAllowedToPerformSingle(user.id, action, model, body)))
      .then(function (allowedArray) {
        return allowedArray.every(function (allowed) {
          return allowed === true;
        });
      });
  }
117166
private Delta createDelta(PermissionUpdateRequest request) {
        MapDeltaBuilder builder = Deltas.mapBuilder();

        for (String permissionString : request.getPermitted()) {
            builder.put("perm_" + validated(permissionString), 1);
        }
        for (String permissionString : request.getRevoked()) {
            builder.remove("perm_" + validated(permissionString));
        }
        if (request.isRevokeRest()) {
            builder.removeRest();
        }
        return builder.build();
    }
995650
function() {
    var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, produces, isXML, isJSON;
    isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
    if (!isMethodSubmissionSupported) {
      this.model.isReadOnly = true;
    }
    this.model.description = this.model.description || this.model.notes;
    this.model.oauth = null;
    modelAuths = this.model.authorizations || this.model.security;
    if (modelAuths) {
      if (Array.isArray(modelAuths)) {
        for (l = 0, len = modelAuths.length; l < len; l++) {
          auths = modelAuths[l];
          for (key in auths) {
            for (a in this.auths) {
              auth = this.auths[a];
              if (key === auth.name) {
                if (auth.type === 'oauth2') {
                  this.model.oauth = {};
                  this.model.oauth.scopes = [];
                  ref1 = auth.value.scopes;
                  for (k in ref1) {
                    v = ref1[k];
                    scopeIndex = auths[key].indexOf(k);
                    if (scopeIndex >= 0) {
                      o = {
                        scope: k,
                        description: v
                      };
                      this.model.oauth.scopes.push(o);
                    }
                  }
                }
              }
            }
          }
        }
      } else {
        for (k in modelAuths) {
          v = modelAuths[k];
          if (k === 'oauth2') {
            if (this.model.oauth === null) {
              this.model.oauth = {};
            }
            if (this.model.oauth.scopes === void 0) {
              this.model.oauth.scopes = [];
            }
            for (m = 0, len1 = v.length; m < len1; m++) {
              o = v[m];
              this.model.oauth.scopes.push(o);
            }
          }
        }
      }
    }
    if (typeof this.model.responses !== 'undefined') {
      this.model.responseMessages = [];
      ref2 = this.model.responses;
      for (code in ref2) {
        value = ref2[code];
        schema = null;
        schemaObj = this.model.responses[code].schema;
        if (schemaObj && schemaObj.$ref) {
          schema = schemaObj.$ref;
          if (schema.indexOf('#/definitions/') !== -1) {
            schema = schema.replace(/^.*#\/definitions\//, '');
          }
        }
        this.model.responseMessages.push({
          code: code,
          message: value.description,
          responseModel: schema,
          headers: value.headers,
          schema: schemaObj
        });
      }
    }
    if (typeof this.model.responseMessages === 'undefined') {
      this.model.responseMessages = [];
    }
    signatureModel = null;
    produces = this.model.produces;
    isXML = this.contains(produces, 'xml');
    isJSON = isXML ? this.contains(produces, 'json') : true;

    if (this.model.successResponse) {
      successResponse = this.model.successResponse;
      for (key in successResponse) {
        value = successResponse[key];
        this.model.successCode = key;
        if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
          this.model.successDescription = value.description;
          this.model.headers = this.parseResponseHeaders(value.headers);
          signatureModel = {
            sampleJSON: isJSON ? JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2) : false,
            isParam: false,
            sampleXML: isXML ? SwaggerUi.partials.signature.createXMLSample(value.name, value.definition, value.models) : false,
            signature: SwaggerUi.partials.signature.getModelSignature(value.name, value.definition, value.models, value.modelPropertyMacro)
          };
        } else {
          signatureModel = {
            signature: SwaggerUi.partials.signature.getPrimitiveSignature(value)
          };
        }
      }
    } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
      signatureModel = {
        sampleJSON: this.model.responseSampleJSON,
        isParam: false,
        signature: this.model.responseClassSignature
      };
    }
    $(this.el).html(Handlebars.templates.operation(this.model));
    if (signatureModel) {
      signatureModel.defaultRendering = this.model.defaultRendering;
      responseSignatureView = new SwaggerUi.Views.SignatureView({
        model: signatureModel,
        router: this.router,
        tagName: 'div'
      });
      $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
    } else {
      this.model.responseClassSignature = 'string';
      $('.model-signature', $(this.el)).html(this.model.type);
    }
    contentTypeModel = {
      isParam: false
    };
    contentTypeModel.consumes = this.model.consumes;
    contentTypeModel.produces = this.model.produces;
    ref3 = this.model.parameters;
    for (n = 0, len2 = ref3.length; n < len2; n++) {
      param = ref3[n];
      type = param.type || param.dataType || '';
      if (typeof type === 'undefined') {
        schema = param.schema;
        if (schema && schema.$ref) {
          ref = schema.$ref;
          if (ref.indexOf('#/definitions/') === 0) {
            type = ref.substring('#/definitions/'.length);
          } else {
            type = ref;
          }
        }
      }
      if (type && type.toLowerCase() === 'file') {
        if (!contentTypeModel.consumes) {
          contentTypeModel.consumes = 'multipart/form-data';
        }
      }
      param.type = type;
    }
    responseContentTypeView = new SwaggerUi.Views.ResponseContentTypeView({
      model: contentTypeModel,
      router: this.router
    });
    $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
    ref4 = this.model.parameters;
    for (p = 0, len3 = ref4.length; p < len3; p++) {
      param = ref4[p];
      this.addParameter(param, contentTypeModel.consumes);
    }
    ref5 = this.model.responseMessages;
    for (q = 0, len4 = ref5.length; q < len4; q++) {
      statusCode = ref5[q];
      statusCode.isXML = isXML;
      statusCode.isJSON = isJSON;
      if (!_.isUndefined(statusCode.headers)) {
        statusCode.headers = this.parseHeadersType(statusCode.headers);
      }
      this.addStatusCode(statusCode);
    }

    if (Array.isArray(this.model.security)) {
      var authsModel = SwaggerUi.utils.parseSecurityDefinitions(this.model.security);

      authsModel.isLogout = !_.isEmpty(window.swaggerUi.api.clientAuthorizations.authz);
      this.authView = new SwaggerUi.Views.AuthButtonView({
        data: authsModel,
        router: this.router,
        isOperation: true,
        model: {
          scopes: authsModel.scopes
        }
      });
      this.$('.authorize-wrapper').append(this.authView.render().el);
    }

    this.showSnippet();
    return this;
  }