示例#1
0
        private void ClientOnGetHighestPermissionNameCompleted(object sender, GetPermissionNameForObjectCompletedEventArgs e)
        {
            var item = DataContext as IManagementConsoleObject;

            if (!e.Result.HasError && item != null)
            {
                var id = sender as Guid?;
                if (id != null && id == item.Id)
                {
                    item.CurrentUserPermissionLevel = PermissionLevel.Convert(e.Result.Result);
                    //todo: if the user is security manager, needs to be returned as well
                    if (item.CurrentUserPermissionLevel >= PermissionLevel.Author || App.PermissionLevel == PermissionLevel.SecurityManager)
                    {
                        NewMapButton.IsEnabled = true;
                        if (item.CurrentUserPermissionLevel >= PermissionLevel.MapManager || App.PermissionLevel == PermissionLevel.SecurityManager)
                        {
                            DeleteButton.IsEnabled = true;
                        }
                    }

                    if (App.PermissionLevel != PermissionLevel.SecurityManager)
                    {
                        item.IsLoaded = true;
                    }
                }
            }
            else
            {
                SuperMessageBoxService.ShowError("Error Occurred", "There was a problem reading Glyma permissions, please try again later");
            }
        }
示例#2
0
 private void GetUsersPermissionLevelNameCompleted(object sender, GetUsersPermissionLevelNameCompletedEventArgs e)
 {
     if (!e.Result.HasError)
     {
         var permission = PermissionLevel.Convert(e.Result.Result);
         App.PermissionLevel = permission;
         if (permission != PermissionLevel.None)
         {
             SuperGraph.ExplorerOnly = permission < PermissionLevel.Author;
             DebugLogger.Instance.LogMsg("User Permission Loaded: " + permission);
             if (IsLoadMapByGuid)
             {
                 DebugLogger.Instance.LogMsg(string.Format("Loading map through URL: NodeId[{0}],MapId[{1}],DomainId[{2}]", NodeId, MapId, DomainId));
                 PreLoader.ReadyToInitialiseControllers += OnReadyToInitialiseControllers;
                 PreLoader.Load(DomainId, NodeId, MapId);
             }
             else
             {
                 Loader.Visibility = Visibility.Collapsed;
                 HomeScreen();
             }
         }
         else
         {
             SuperMessageBoxService.Show("Access Denied", "It seems that you don't have permission to access Glyma, please contact your system administrator for assistance.", MessageBoxType.ErrorWithNoInput);
         }
     }
     else
     {
         SuperMessageBoxService.ShowError("Error Occurred", "There was a problem reading Glyma permissions, please try again later");
     }
 }
 private void ClientOnGetAllSecurityGroupsCompleted(object sender, GetAllSecurityGroupsCompletedEventArgs e)
 {
     if (!e.Result.HasError)
     {
         foreach (var pair in e.Result.Result)
         {
             SecurityGroups.Add(PermissionLevel.Convert(pair.Key), pair.Value);
         }
         foreach (var valuePair in SecurityGroups)
         {
             foreach (var item in valuePair.Value)
             {
                 if (AllSecurityGroups.All(q => q.GroupId != item.GroupId))
                 {
                     AllSecurityGroups.Add(item);
                 }
             }
         }
         MapManager.QueryDomainsCompleted.RegisterEvent(OnAcquireDomainsCompleted);
         MapManager.QueryDomainsAsync();
     }
     else
     {
         SuperMessageBoxService.ShowError("Error Occurred",
                                          "An error occurred while retrieving the groups with Glyma permissions.", Close);
     }
 }
示例#4
0
        private void ClientOnGetPermissionNameForObjectCompleted(object sender, GetPermissionNameForObjectCompletedEventArgs e)
        {
            var permissionLevel = PermissionLevel.None;

            if (!e.Result.HasError && Context == sender)
            {
                var permission = PermissionLevel.Convert(e.Result.Result);
                if (permission >= PermissionLevel.Author || App.PermissionLevel == PermissionLevel.OldAuthor || App.PermissionLevel == PermissionLevel.SecurityManager)
                {
                    permissionLevel = PermissionLevel.Author;
                }
                else if (permission >= PermissionLevel.Reader || App.PermissionLevel == PermissionLevel.OldReader)
                {
                    permissionLevel = PermissionLevel.Reader;
                }
                else if (permission == PermissionLevel.None)
                {
                    SuperMessageBoxService.Show("Access Denied", "It seems that you don't have permission to access this map, please contact your system administrator for assistance.", MessageBoxType.ErrorWithNoInput);
                    return;
                }
            }
            else
            {
                SuperMessageBoxService.ShowError("Error Occurred", "There was a problem reading Glyma permissions, please try again later");
                return;
            }

            if (PermissionLoaded != null)
            {
                PermissionLoaded(this, new UserPermissionEventArgs {
                    Permission = permissionLevel
                });
            }

            ActiveModel = new Map();

            var nodeType = MapManager.NodeTypes[Context.MapObjectType];

            if (nodeType == MapManager.NodeTypes["CompendiumMapNode"])
            {
                MapManager.QueryMapByNodeCompleted.RegisterEvent(Context.Proxy, LoadNodesCompleted, Context.Proxy);
                MapManager.QueryMapByNodeAsync(Context.Proxy, 1);
            }

            VideoController.Clear();
        }