CleverStack/clever-roles

View on GitHub
controllers/PermissionController.js

Summary

Maintainability
C
1 day
Test Coverage

Function exports has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(async, _, Controller, PermissionService) {
  var AccountController = null;

  var PermissionController = Controller.extend(
  {  
Severity: Major
Found in controllers/PermissionController.js - About 5 hrs to fix

    Function requiresPermission has 95 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        requiresPermission: function(requiredPermissions) {
          if (requiredPermissions instanceof Array) {
            requiredPermissions = {
              all: requiredPermissions
            }
    Severity: Major
    Found in controllers/PermissionController.js - About 3 hrs to fix

      Function userRoleHasPermission has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  function userRoleHasPermission(permissions, callback) {
                    var hasPermission = true;
      
                    if (!!permissions.length && !req.isAuthenticated()) {
                      return callback('User is not authenticated!');
      Severity: Minor
      Found in controllers/PermissionController.js - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status