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() {
|
||||
EndpointService.endpoints()
|
||||
.then(function success(data) {
|
||||
.then(function success(endpoints) {
|
||||
if (endpoints.length === 0) {
|
||||
$state.go('portainer.init.endpoint');
|
||||
} else {
|
||||
|
|
|
@ -16,17 +16,20 @@ function ($q, $scope, StateManager, Notifications, Authentication, UserService)
|
|||
$scope.uiVersion = StateManager.getState().application.version;
|
||||
$scope.logo = StateManager.getState().application.logo;
|
||||
|
||||
var userDetails = Authentication.getUserDetails();
|
||||
var isAdmin = userDetails.role === 1;
|
||||
$scope.isAdmin = isAdmin;
|
||||
var authenticationEnabled = $scope.applicationState.application.authentication;
|
||||
if (authenticationEnabled) {
|
||||
var userDetails = Authentication.getUserDetails();
|
||||
var isAdmin = userDetails.role === 1;
|
||||
$scope.isAdmin = isAdmin;
|
||||
|
||||
$q.when(!isAdmin ? UserService.userMemberships(userDetails.ID) : [])
|
||||
.then(function success(data) {
|
||||
checkPermissions(data);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve user memberships');
|
||||
});
|
||||
$q.when(!isAdmin ? UserService.userMemberships(userDetails.ID) : [])
|
||||
.then(function success(data) {
|
||||
checkPermissions(data);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve user memberships');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
initView();
|
||||
|
|
Loading…
Reference in New Issue