code: function handleOnBeforeWebHook(transition) {
        setTransitionProperties(transition);
        var statePermissionMap = new PermStatePermissionMap(PermTransitionProperties.toState);
  
        return PermStateAuthorization
          .authorizeByPermissionMap(statePermissionMap)
          .catch(function (rejectedPermission) {
            return statePermissionMap
              .resolveRedirectState(rejectedPermission)
              .then(function (redirect) {
                return transition.router.stateService.target(redirect.state, redirect.params, redirect.options);
              });
          });
  
        /**
         * Updates values of `PermTransitionProperties` holder object
         * @method
         * @private
         */
        function setTransitionProperties(transition) {
          PermTransitionProperties.toState = transition.to();
          PermTransitionProperties.toParams = transition.params('to');
          PermTransitionProperties.fromState = transition.from();
          PermTransitionProperties.fromParams = transition.params('from');
          PermTransitionProperties.options = transition.options();
        }
      }
docs: State transition web hook
  @param transition {Object}