use of org.eclipse.che.multiuser.permission.devfile.server.model.UserDevfilePermission in project devspaces-images by redhat-developer.
the class JpaTckModule method configure.
@Override
protected void configure() {
H2DBTestServer server = H2DBTestServer.startDefault();
install(new PersistTestModuleBuilder().setDriver(Driver.class).runningOn(server).addEntityClasses(AccountImpl.class, UserImpl.class, UserDevfilePermissionImpl.class, // devfile
ActionImpl.class, org.eclipse.che.api.workspace.server.model.impl.devfile.CommandImpl.class, ComponentImpl.class, DevfileImpl.class, EndpointImpl.class, EntrypointImpl.class, EnvImpl.class, ProjectImpl.class, SourceImpl.class, UserDevfileImpl.class, org.eclipse.che.api.workspace.server.model.impl.devfile.VolumeImpl.class).addClass(SerializableConverter.class).setExceptionHandler(H2ExceptionHandler.class).build());
bind(new TypeLiteral<AbstractPermissionsDomain<UserDevfilePermissionImpl>>() {
}).to(UserDevfilePermissionDaoTest.TestDomain.class);
bind(UserDevfilePermissionDao.class).to(JpaUserDevfilePermissionDao.class);
bind(AccountDao.class).to(JpaAccountDao.class);
bind(new TypeLiteral<TckRepository<UserDevfilePermission>>() {
}).toInstance(new JpaTckRepository<>(UserDevfilePermission.class));
bind(new TypeLiteral<TckRepository<UserImpl>>() {
}).toInstance(new JpaTckRepository<>(UserImpl.class));
bind(new TypeLiteral<TckRepository<UserDevfileImpl>>() {
}).toInstance(new JpaTckRepository<>(UserDevfileImpl.class));
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
bind(DBInitializer.class).asEagerSingleton();
bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
}
use of org.eclipse.che.multiuser.permission.devfile.server.model.UserDevfilePermission in project che-server by eclipse-che.
the class JpaTckModule method configure.
@Override
protected void configure() {
H2DBTestServer server = H2DBTestServer.startDefault();
install(new PersistTestModuleBuilder().setDriver(Driver.class).runningOn(server).addEntityClasses(AccountImpl.class, UserImpl.class, UserDevfilePermissionImpl.class, // devfile
ActionImpl.class, org.eclipse.che.api.workspace.server.model.impl.devfile.CommandImpl.class, ComponentImpl.class, DevfileImpl.class, EndpointImpl.class, EntrypointImpl.class, EnvImpl.class, ProjectImpl.class, SourceImpl.class, UserDevfileImpl.class, org.eclipse.che.api.workspace.server.model.impl.devfile.VolumeImpl.class).addClass(SerializableConverter.class).setExceptionHandler(H2ExceptionHandler.class).build());
bind(new TypeLiteral<AbstractPermissionsDomain<UserDevfilePermissionImpl>>() {
}).to(UserDevfilePermissionDaoTest.TestDomain.class);
bind(UserDevfilePermissionDao.class).to(JpaUserDevfilePermissionDao.class);
bind(AccountDao.class).to(JpaAccountDao.class);
bind(new TypeLiteral<TckRepository<UserDevfilePermission>>() {
}).toInstance(new JpaTckRepository<>(UserDevfilePermission.class));
bind(new TypeLiteral<TckRepository<UserImpl>>() {
}).toInstance(new JpaTckRepository<>(UserImpl.class));
bind(new TypeLiteral<TckRepository<UserDevfileImpl>>() {
}).toInstance(new JpaTckRepository<>(UserDevfileImpl.class));
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
bind(DBInitializer.class).asEagerSingleton();
bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
}
use of org.eclipse.che.multiuser.permission.devfile.server.model.UserDevfilePermission in project che-server by eclipse-che.
the class MultiuserMySqlTckModule method configure.
@Override
protected void configure() {
final Map<String, String> properties = new HashMap<>();
properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());
final String dbUrl = System.getProperty("jdbc.url");
final String dbUser = System.getProperty("jdbc.user");
final String dbPassword = System.getProperty("jdbc.password");
waitConnectionIsEstablished(dbUrl, dbUser, dbPassword);
properties.put(JDBC_URL, dbUrl);
properties.put(JDBC_USER, dbUser);
properties.put(JDBC_PASSWORD, dbPassword);
properties.put(JDBC_DRIVER, System.getProperty("jdbc.driver"));
JpaPersistModule main = new JpaPersistModule("main");
main.properties(properties);
install(main);
final com.mysql.cj.jdbc.MysqlDataSource dataSource = new com.mysql.cj.jdbc.MysqlDataSource();
dataSource.setUser(dbUser);
dataSource.setPassword(dbPassword);
dataSource.setUrl(dbUrl);
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(dataSource, "che-schema"));
bind(DBInitializer.class).asEagerSingleton();
bind(TckResourcesCleaner.class).to(JpaCleaner.class);
// repositories
// api-account
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
// api-user
bind(new TypeLiteral<TckRepository<UserImpl>>() {
}).to(UserJpaTckRepository.class);
// api-workspace
bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {
}).toInstance(new JpaTckRepository<>(WorkspaceImpl.class));
bind(new TypeLiteral<TckRepository<WorkerImpl>>() {
}).toInstance(new JpaTckRepository<>(WorkerImpl.class));
// api permission
bind(new TypeLiteral<TckRepository<SystemPermissionsImpl>>() {
}).toInstance(new JpaTckRepository<>(SystemPermissionsImpl.class));
bind(new TypeLiteral<PermissionsDao<SystemPermissionsImpl>>() {
}).to(JpaSystemPermissionsDao.class);
bind(new TypeLiteral<AbstractPermissionsDomain<WorkerImpl>>() {
}).to(WorkerDaoTest.TestDomain.class);
bind(new TypeLiteral<AbstractPermissionsDomain<SystemPermissionsImpl>>() {
}).to(SystemPermissionsDaoTest.TestDomain.class);
// api-organization
bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {
}).to(JpaOrganizationImplTckRepository.class);
bind(new TypeLiteral<TckRepository<MemberImpl>>() {
}).toInstance(new JpaTckRepository<>(MemberImpl.class));
bind(new TypeLiteral<TckRepository<OrganizationDistributedResourcesImpl>>() {
}).toInstance(new JpaTckRepository<>(OrganizationDistributedResourcesImpl.class));
// api-resource
bind(new TypeLiteral<TckRepository<FreeResourcesLimitImpl>>() {
}).toInstance(new JpaTckRepository<>(FreeResourcesLimitImpl.class));
// machine token keys
bind(new TypeLiteral<TckRepository<SignatureKeyPairImpl>>() {
}).toInstance(new JpaTckRepository<>(SignatureKeyPairImpl.class));
bind(new TypeLiteral<TckRepository<UserDevfileImpl>>() {
}).toInstance(new JpaTckRepository<>(UserDevfileImpl.class));
// dao
bind(OrganizationDao.class).to(JpaOrganizationDao.class);
bind(OrganizationDistributedResourcesDao.class).to(JpaOrganizationDistributedResourcesDao.class);
bind(FreeResourcesLimitDao.class).to(JpaFreeResourcesLimitDao.class);
bind(WorkerDao.class).to(JpaWorkerDao.class);
bind(MemberDao.class).to(JpaMemberDao.class);
bind(SignatureKeyDao.class).to(JpaSignatureKeyDao.class);
bind(new TypeLiteral<PermissionsDao<MemberImpl>>() {
}).to(JpaMemberDao.class);
bind(new TypeLiteral<AbstractPermissionsDomain<MemberImpl>>() {
}).to(OrganizationDomain.class);
bind(UserDevfilePermissionDao.class).to(JpaUserDevfilePermissionDao.class);
bind(new TypeLiteral<AbstractPermissionsDomain<UserDevfilePermissionImpl>>() {
}).to(UserDevfileDomain.class);
bind(new TypeLiteral<TckRepository<UserDevfilePermission>>() {
}).toInstance(new JpaTckRepository<>(UserDevfilePermission.class));
// SHA-512 ecnryptor is faster than PBKDF2 so it is better for testing
bind(PasswordEncryptor.class).to(SHA512PasswordEncryptor.class).in(Singleton.class);
// Creates empty multibinder to avoid error during container starting
Multibinder.newSetBinder(binder(), String.class, Names.named(SystemDomain.SYSTEM_DOMAIN_ACTIONS));
}
use of org.eclipse.che.multiuser.permission.devfile.server.model.UserDevfilePermission in project che-server by eclipse-che.
the class MultiuserPostgresqlTckModule method configure.
@Override
protected void configure() {
final Map<String, String> properties = new HashMap<>();
properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());
final String dbUrl = System.getProperty("jdbc.url");
final String dbUser = System.getProperty("jdbc.user");
final String dbPassword = System.getProperty("jdbc.password");
waitConnectionIsEstablished(dbUrl, dbUser, dbPassword);
properties.put(JDBC_URL, dbUrl);
properties.put(JDBC_USER, dbUser);
properties.put(JDBC_PASSWORD, dbPassword);
properties.put(JDBC_DRIVER, System.getProperty("jdbc.driver"));
JpaPersistModule main = new JpaPersistModule("main");
main.properties(properties);
install(main);
final PGSimpleDataSource dataSource = new PGSimpleDataSource();
dataSource.setUser(dbUser);
dataSource.setPassword(dbPassword);
dataSource.setUrl(dbUrl);
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(dataSource, "che-schema"));
bind(DBInitializer.class).asEagerSingleton();
bind(TckResourcesCleaner.class).to(JpaCleaner.class);
// repositories
// api-account
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
// api-user
bind(new TypeLiteral<TckRepository<UserImpl>>() {
}).to(UserJpaTckRepository.class);
// api-workspace
bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {
}).toInstance(new JpaTckRepository<>(WorkspaceImpl.class));
bind(new TypeLiteral<TckRepository<WorkerImpl>>() {
}).toInstance(new JpaTckRepository<>(WorkerImpl.class));
// api permission
bind(new TypeLiteral<TckRepository<SystemPermissionsImpl>>() {
}).toInstance(new JpaTckRepository<>(SystemPermissionsImpl.class));
bind(new TypeLiteral<PermissionsDao<SystemPermissionsImpl>>() {
}).to(JpaSystemPermissionsDao.class);
bind(new TypeLiteral<AbstractPermissionsDomain<WorkerImpl>>() {
}).to(WorkerDaoTest.TestDomain.class);
bind(new TypeLiteral<AbstractPermissionsDomain<SystemPermissionsImpl>>() {
}).to(SystemPermissionsDaoTest.TestDomain.class);
// api-organization
bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {
}).to(JpaOrganizationImplTckRepository.class);
bind(new TypeLiteral<TckRepository<MemberImpl>>() {
}).toInstance(new JpaTckRepository<>(MemberImpl.class));
bind(new TypeLiteral<TckRepository<OrganizationDistributedResourcesImpl>>() {
}).toInstance(new JpaTckRepository<>(OrganizationDistributedResourcesImpl.class));
// api-resource
bind(new TypeLiteral<TckRepository<FreeResourcesLimitImpl>>() {
}).toInstance(new JpaTckRepository<>(FreeResourcesLimitImpl.class));
// machine token keys
bind(new TypeLiteral<TckRepository<SignatureKeyPairImpl>>() {
}).toInstance(new JpaTckRepository<>(SignatureKeyPairImpl.class));
bind(new TypeLiteral<TckRepository<UserDevfileImpl>>() {
}).toInstance(new JpaTckRepository<>(UserDevfileImpl.class));
// dao
bind(OrganizationDao.class).to(JpaOrganizationDao.class);
bind(OrganizationDistributedResourcesDao.class).to(JpaOrganizationDistributedResourcesDao.class);
bind(FreeResourcesLimitDao.class).to(JpaFreeResourcesLimitDao.class);
bind(WorkerDao.class).to(JpaWorkerDao.class);
bind(MemberDao.class).to(JpaMemberDao.class);
bind(SignatureKeyDao.class).to(JpaSignatureKeyDao.class);
bind(new TypeLiteral<PermissionsDao<MemberImpl>>() {
}).to(JpaMemberDao.class);
bind(new TypeLiteral<AbstractPermissionsDomain<MemberImpl>>() {
}).to(OrganizationDomain.class);
bind(UserDevfilePermissionDao.class).to(JpaUserDevfilePermissionDao.class);
bind(new TypeLiteral<AbstractPermissionsDomain<UserDevfilePermissionImpl>>() {
}).to(UserDevfileDomain.class);
bind(new TypeLiteral<TckRepository<UserDevfilePermission>>() {
}).toInstance(new JpaTckRepository<>(UserDevfilePermission.class));
// SHA-512 ecnryptor is faster than PBKDF2 so it is better for testing
bind(PasswordEncryptor.class).to(SHA512PasswordEncryptor.class).in(Singleton.class);
// Creates empty multibinder to avoid error during container starting
Multibinder.newSetBinder(binder(), String.class, Names.named(SystemDomain.SYSTEM_DOMAIN_ACTIONS));
}
use of org.eclipse.che.multiuser.permission.devfile.server.model.UserDevfilePermission in project devspaces-images by redhat-developer.
the class MultiuserMySqlTckModule method configure.
@Override
protected void configure() {
final Map<String, String> properties = new HashMap<>();
properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());
final String dbUrl = System.getProperty("jdbc.url");
final String dbUser = System.getProperty("jdbc.user");
final String dbPassword = System.getProperty("jdbc.password");
waitConnectionIsEstablished(dbUrl, dbUser, dbPassword);
properties.put(JDBC_URL, dbUrl);
properties.put(JDBC_USER, dbUser);
properties.put(JDBC_PASSWORD, dbPassword);
properties.put(JDBC_DRIVER, System.getProperty("jdbc.driver"));
JpaPersistModule main = new JpaPersistModule("main");
main.properties(properties);
install(main);
final com.mysql.cj.jdbc.MysqlDataSource dataSource = new com.mysql.cj.jdbc.MysqlDataSource();
dataSource.setUser(dbUser);
dataSource.setPassword(dbPassword);
dataSource.setUrl(dbUrl);
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(dataSource, "che-schema"));
bind(DBInitializer.class).asEagerSingleton();
bind(TckResourcesCleaner.class).to(JpaCleaner.class);
// repositories
// api-account
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
// api-user
bind(new TypeLiteral<TckRepository<UserImpl>>() {
}).to(UserJpaTckRepository.class);
// api-workspace
bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {
}).toInstance(new JpaTckRepository<>(WorkspaceImpl.class));
bind(new TypeLiteral<TckRepository<WorkerImpl>>() {
}).toInstance(new JpaTckRepository<>(WorkerImpl.class));
// api permission
bind(new TypeLiteral<TckRepository<SystemPermissionsImpl>>() {
}).toInstance(new JpaTckRepository<>(SystemPermissionsImpl.class));
bind(new TypeLiteral<PermissionsDao<SystemPermissionsImpl>>() {
}).to(JpaSystemPermissionsDao.class);
bind(new TypeLiteral<AbstractPermissionsDomain<WorkerImpl>>() {
}).to(WorkerDaoTest.TestDomain.class);
bind(new TypeLiteral<AbstractPermissionsDomain<SystemPermissionsImpl>>() {
}).to(SystemPermissionsDaoTest.TestDomain.class);
// api-organization
bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {
}).to(JpaOrganizationImplTckRepository.class);
bind(new TypeLiteral<TckRepository<MemberImpl>>() {
}).toInstance(new JpaTckRepository<>(MemberImpl.class));
bind(new TypeLiteral<TckRepository<OrganizationDistributedResourcesImpl>>() {
}).toInstance(new JpaTckRepository<>(OrganizationDistributedResourcesImpl.class));
// api-resource
bind(new TypeLiteral<TckRepository<FreeResourcesLimitImpl>>() {
}).toInstance(new JpaTckRepository<>(FreeResourcesLimitImpl.class));
// machine token keys
bind(new TypeLiteral<TckRepository<SignatureKeyPairImpl>>() {
}).toInstance(new JpaTckRepository<>(SignatureKeyPairImpl.class));
bind(new TypeLiteral<TckRepository<UserDevfileImpl>>() {
}).toInstance(new JpaTckRepository<>(UserDevfileImpl.class));
// dao
bind(OrganizationDao.class).to(JpaOrganizationDao.class);
bind(OrganizationDistributedResourcesDao.class).to(JpaOrganizationDistributedResourcesDao.class);
bind(FreeResourcesLimitDao.class).to(JpaFreeResourcesLimitDao.class);
bind(WorkerDao.class).to(JpaWorkerDao.class);
bind(MemberDao.class).to(JpaMemberDao.class);
bind(SignatureKeyDao.class).to(JpaSignatureKeyDao.class);
bind(new TypeLiteral<PermissionsDao<MemberImpl>>() {
}).to(JpaMemberDao.class);
bind(new TypeLiteral<AbstractPermissionsDomain<MemberImpl>>() {
}).to(OrganizationDomain.class);
bind(UserDevfilePermissionDao.class).to(JpaUserDevfilePermissionDao.class);
bind(new TypeLiteral<AbstractPermissionsDomain<UserDevfilePermissionImpl>>() {
}).to(UserDevfileDomain.class);
bind(new TypeLiteral<TckRepository<UserDevfilePermission>>() {
}).toInstance(new JpaTckRepository<>(UserDevfilePermission.class));
// SHA-512 ecnryptor is faster than PBKDF2 so it is better for testing
bind(PasswordEncryptor.class).to(SHA512PasswordEncryptor.class).in(Singleton.class);
// Creates empty multibinder to avoid error during container starting
Multibinder.newSetBinder(binder(), String.class, Names.named(SystemDomain.SYSTEM_DOMAIN_ACTIONS));
}
Aggregations