Search in sources :

Example 1 with AppId

use of io.lumeer.api.model.AppId in project engine by Lumeer.

the class PusherAdapterIT method configureProject.

@Before
public void configureProject() {
    user = userDao.createUser(new User(USER));
    otherUser = userDao.createUser(new User("otherUser"));
    Organization organization = new Organization();
    organization.setCode(ORGANIZATION_CODE);
    Permissions organizationPermissions = new Permissions();
    final Permission userPermission = Permission.buildWithRoles(this.user.getId(), READ_ROLES);
    organizationPermissions.updateUserPermissions(userPermission);
    organization.setPermissions(organizationPermissions);
    this.organization = organizationDao.createOrganization(organization);
    projectDao.setOrganization(this.organization);
    groupDao.setOrganization(this.organization);
    group = groupDao.createGroup(new Group(GROUP, List.of(user.getId(), otherUser.getId())));
    user.setOrganizations(Collections.singleton(this.organization.getId()));
    user = userDao.updateUser(user.getId(), user);
    otherUser.setOrganizations(Collections.singleton(this.organization.getId()));
    otherUser = userDao.updateUser(otherUser.getId(), otherUser);
    Project project = new Project();
    project.setCode(PROJECT_CODE);
    Permissions projectPermissions = new Permissions();
    projectPermissions.updateUserPermissions(Permission.buildWithRoles(this.user.getId(), READ_ROLES));
    project.setPermissions(projectPermissions);
    this.project = projectDao.createProject(project);
    collectionDao.setProject(project);
    viewDao.setProject(project);
    linkTypeDao.setProject(project);
    FacadeAdapter facadeAdapter = new FacadeAdapter(permissionsChecker.getPermissionAdapter());
    ResourceAdapter resourceAdapter = new ResourceAdapter(permissionsChecker.getPermissionAdapter(), collectionDao, linkTypeDao, viewDao, userDao);
    pusherAdapter = new PusherAdapter(new AppId(""), facadeAdapter, resourceAdapter, permissionsChecker.getPermissionAdapter(), viewDao, linkTypeDao, collectionDao);
    permissionsChecker.getPermissionAdapter().invalidateUserCache();
}
Also used : Group(io.lumeer.api.model.Group) Project(io.lumeer.api.model.Project) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.auth.AuthenticatedUser) Organization(io.lumeer.api.model.Organization) AppId(io.lumeer.api.model.AppId) Permissions(io.lumeer.api.model.Permissions) Permission(io.lumeer.api.model.Permission) Before(org.junit.Before)

Aggregations

AppId (io.lumeer.api.model.AppId)1 Group (io.lumeer.api.model.Group)1 Organization (io.lumeer.api.model.Organization)1 Permission (io.lumeer.api.model.Permission)1 Permissions (io.lumeer.api.model.Permissions)1 Project (io.lumeer.api.model.Project)1 User (io.lumeer.api.model.User)1 AuthenticatedUser (io.lumeer.core.auth.AuthenticatedUser)1 Before (org.junit.Before)1