All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webapp.scripts.components.auth.security.service.js Maven / Gradle / Ivy

Go to download

Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2 (centraldogma-server)

There is a newer version: 0.73.1
Show newest version
'use strict';

angular.module('CentralDogmaAdmin')
        .factory('Security',
  function ($rootScope, $http, $q, NotificationUtil) {
    return {
      resolve: function () {
        var defer = $q.defer();
        if (this.isResolved()) {
          defer.resolve($rootScope.isSecurityEnabled);
        } else {
          $http.get('/security_enabled').then(function () {
            $rootScope.isSecurityEnabled = true;
            defer.resolve(true);
          }, function (error) {
            if (error.status === 404) {
              defer.resolve(false);
            } else {
              NotificationUtil.error(error);
              defer.reject(error);
            }
          });
        }
        return defer.promise;
      },

      isResolved: function () {
        return angular.isDefined($rootScope.isSecurityEnabled);
      }
    };
  });




© 2015 - 2025 Weber Informatics LLC | Privacy Policy