wait until $rootScope.current_user is available, resolves #2126 (#2246)

This commit is contained in:
Leigh
2016-06-09 09:57:25 -04:00
parent 3e8aaa4b5e
commit f9a5955cc0

View File

@@ -178,6 +178,8 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log,
$scope.canShareCredential = false;
$rootScope.$watch('current_user', function(){
try {
if ($rootScope.current_user.is_superuser) {
$scope.canShareCredential = true;
} else {
@@ -205,6 +207,11 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log,
input_type: 'radio',
autopopulateLookup: false
});
}
catch(err){
// $rootScope.current_user isn't available because a call to the config endpoint hasn't finished resolving yet
}
});
if (!Empty($stateParams.user_id)) {
// Get the username based on incoming route