Exemple #1
0
 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     return(OperationAuthClient.GetAllowed(operationKey, InUserInterface) ? Visibility.Visible : Visibility.Collapsed);
 }
Exemple #2
0
        public static void Start(bool types, bool property, bool queries, bool permissions, bool operations, bool defaultPasswordExpiresLogic)
        {
            if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                Server.Connecting += UpdateCache;

                if (types)
                {
                    TypeAuthClient.Start();
                }
                if (property)
                {
                    PropertyAuthClient.Start();
                }
                if (queries)
                {
                    QueryAuthClient.Start();
                }
                if (permissions)
                {
                    PermissionAuthClient.Start();
                }
                if (operations)
                {
                    OperationAuthClient.Start();
                }

                UpdateCache();

                Navigator.AddSetting(new EntitySettings <UserEntity> {
                    View = e => new User(), Icon = ImageLoader.GetImageSortName("user.png")
                });
                Navigator.AddSetting(new EntitySettings <RoleEntity> {
                    View = e => new Role(), Icon = ImageLoader.GetImageSortName("role.png")
                });

                if (defaultPasswordExpiresLogic)
                {
                    Navigator.AddSetting(new EntitySettings <PasswordExpiresIntervalEntity> {
                        View = e => new PasswordExpiresInterval()
                    });
                }

                OperationClient.AddSettings(new List <OperationSettings>()
                {
                    new EntityOperationSettings <UserEntity>(UserOperation.SetPassword)
                    {
                        IsVisible = e => false
                    },
                    new EntityOperationSettings <UserEntity>(UserOperation.SaveNew)
                    {
                        IsVisible = e => e.Entity.IsNew
                    },
                    new EntityOperationSettings <UserEntity>(UserOperation.Save)
                    {
                        IsVisible = e => !e.Entity.IsNew
                    }
                });

                SpecialOmniboxProvider.Register(new SpecialOmniboxAction("UpdateAuthCache",
                                                                         () => true,
                                                                         win =>
                {
                    UpdateCache();

                    MessageBox.Show(AuthMessage.AuthorizationCacheSuccessfullyUpdated.NiceToString());
                }));

                SpecialOmniboxProvider.Register(new SpecialOmniboxAction("DownloadAuthRules",
                                                                         () => BasicPermission.AdminRules.IsAuthorized(),
                                                                         win =>
                {
                    SaveFileDialog sfc = new SaveFileDialog()
                    {
                        FileName = "AuthRules.xml"
                    };
                    if (sfc.ShowDialog() == true)
                    {
                        var bytes = Server.Return((ILoginServer ls) => ls.DownloadAuthRules());

                        File.WriteAllBytes(sfc.FileName, bytes);
                    }
                }));
            }
        }
Exemple #3
0
 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     return(OperationAuthClient.GetAllowed(operationKey, InUserInterface));
 }