Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before @Override public void setup() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public override void Setup()
        {
            base.Setup();
            LdapServerRule.LdapServer.ConfidentialityRequired = _confidentialityRequired;

            EnterpriseAuthAndUserManager authManager = DbRule.resolveDependency(typeof(EnterpriseAuthAndUserManager));
            EnterpriseUserManager        userManager = authManager.UserManager;

            if (userManager != null)
            {
                userManager.NewUser(NONE_USER, _password.GetBytes(), false);
                userManager.NewUser(PROC_USER, _password.GetBytes(), false);
                userManager.NewUser(READ_USER, _password.GetBytes(), false);
                userManager.NewUser(WRITE_USER, _password.GetBytes(), false);
                userManager.AddRoleToUser(PredefinedRoles.READER, READ_USER);
                userManager.AddRoleToUser(PredefinedRoles.PUBLISHER, WRITE_USER);
                userManager.NewRole("role1", PROC_USER);
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldKeepAuthorizationForLifetimeOfTransactionWithProcedureAllowed() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldKeepAuthorizationForLifetimeOfTransactionWithProcedureAllowed()
        {
            RestartServerWithOverriddenSettings(SecuritySettings.ldap_authorization_group_to_role_mapping.name(), "503=admin;504=role1");
            DbRule.resolveDependency(typeof(Procedures)).registerProcedure(typeof(ProcedureInteractionTestBase.ClassWithProcedures));
            AssertKeepAuthorizationForLifetimeOfTransaction("smith", tx => assertThat(tx.run("CALL test.staticReadProcedure()").single().get(0).asString(), equalTo("static")));
        }