mirror of https://github.com/portainer/portainer
fix(authentication): fix an issue with the --no-auth flag (#2090)
parent
2e0d1f289c
commit
024739f9f1
|
@ -15,7 +15,7 @@ function ($scope, $state, $transition$, $sanitize, Authentication, UserService,
|
||||||
|
|
||||||
function unauthenticatedFlow() {
|
function unauthenticatedFlow() {
|
||||||
EndpointService.endpoints()
|
EndpointService.endpoints()
|
||||||
.then(function success(data) {
|
.then(function success(endpoints) {
|
||||||
if (endpoints.length === 0) {
|
if (endpoints.length === 0) {
|
||||||
$state.go('portainer.init.endpoint');
|
$state.go('portainer.init.endpoint');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,17 +16,20 @@ function ($q, $scope, StateManager, Notifications, Authentication, UserService)
|
||||||
$scope.uiVersion = StateManager.getState().application.version;
|
$scope.uiVersion = StateManager.getState().application.version;
|
||||||
$scope.logo = StateManager.getState().application.logo;
|
$scope.logo = StateManager.getState().application.logo;
|
||||||
|
|
||||||
var userDetails = Authentication.getUserDetails();
|
var authenticationEnabled = $scope.applicationState.application.authentication;
|
||||||
var isAdmin = userDetails.role === 1;
|
if (authenticationEnabled) {
|
||||||
$scope.isAdmin = isAdmin;
|
var userDetails = Authentication.getUserDetails();
|
||||||
|
var isAdmin = userDetails.role === 1;
|
||||||
|
$scope.isAdmin = isAdmin;
|
||||||
|
|
||||||
$q.when(!isAdmin ? UserService.userMemberships(userDetails.ID) : [])
|
$q.when(!isAdmin ? UserService.userMemberships(userDetails.ID) : [])
|
||||||
.then(function success(data) {
|
.then(function success(data) {
|
||||||
checkPermissions(data);
|
checkPermissions(data);
|
||||||
})
|
})
|
||||||
.catch(function error(err) {
|
.catch(function error(err) {
|
||||||
Notifications.error('Failure', err, 'Unable to retrieve user memberships');
|
Notifications.error('Failure', err, 'Unable to retrieve user memberships');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initView();
|
initView();
|
||||||
|
|
Loading…
Reference in New Issue