use of org.eclipse.sw360.datahandler.thrift.users.User in project sw360portal by sw360.
the class WhenComputePermissions method the_highest_allowed_action_is_computed_for_user_$_with_user_group_$_and_department_$.
public WhenComputePermissions the_highest_allowed_action_is_computed_for_user_$_with_user_group_$_and_department_$(@Quoted String userEmail, @TEnumToString UserGroup userGroup, @Quoted String userDept) {
final User user = new User(DUMMY_ID, userEmail, userDept).setUserGroup(userGroup);
final DocumentPermissions<Project> projectDocumentPermissions = PermissionUtils.makePermission(project, user);
allowedActions = projectDocumentPermissions.getAllAllowedActions();
return self();
}
use of org.eclipse.sw360.datahandler.thrift.users.User in project sw360portal by sw360.
the class TestServiceHandler method test.
@Override
public TestObject test(TestObject user) throws TException {
TestObject copy = new TestObject(user);
copy.setText(testText);
return copy;
}
use of org.eclipse.sw360.datahandler.thrift.users.User in project sw360portal by sw360.
the class Sw360AttachmentService method getAttachmentByIdForUser.
public AttachmentInfo getAttachmentByIdForUser(String id, User sw360User) throws TException {
ComponentService.Iface sw360ComponentClient = getThriftComponentClient();
List<Release> releases = sw360ComponentClient.getReleaseSummary(sw360User);
for (Release release : releases) {
final Set<Attachment> attachments = release.getAttachments();
if (attachments != null && attachments.size() > 0) {
for (Attachment attachment : attachments) {
if (id.equals(attachment.getAttachmentContentId())) {
return new AttachmentInfo(attachment, release);
}
}
}
}
return null;
}
use of org.eclipse.sw360.datahandler.thrift.users.User in project sw360portal by sw360.
the class AttachmentSpecTest method before.
@Before
public void before() throws TException {
List<Attachment> attachmentList = new ArrayList<>();
attachment = new Attachment();
attachment.setAttachmentContentId("76537653");
attachment.setFilename("spring-core-4.3.4.RELEASE.jar");
attachment.setSha1("da373e491d3863477568896089ee9457bc316783");
attachment.setAttachmentType(AttachmentType.BINARY_SELF);
attachment.setCreatedTeam("Clearing Team 1");
attachment.setCreatedComment("please check before Christmas :)");
attachment.setCreatedOn("2016-12-18");
attachment.setCreatedBy("admin@sw360.org");
attachment.setCheckedTeam("Clearing Team 2");
attachment.setCheckedComment("everything looks good");
attachment.setCheckedOn("2016-12-18");
attachment.setCheckStatus(CheckStatus.ACCEPTED);
attachmentList.add(attachment);
Release release = new Release();
release.setId("874687");
release.setName("Spring Core 4.3.4");
release.setCpeid("cpe:/a:pivotal:spring-core:4.3.4:");
release.setReleaseDate("2016-12-07");
release.setVersion("4.3.4");
release.setCreatedOn("2016-12-18");
release.setCreatedBy("admin@sw360.org");
release.setModerators(new HashSet<>(Arrays.asList(testUserId, testUserPassword)));
release.setComponentId("678dstzd8");
release.setClearingState(ClearingState.APPROVED);
AttachmentInfo attachmentInfo = new AttachmentInfo(attachment, release);
given(this.attachmentServiceMock.getAttachmentByIdForUser(eq(attachment.getAttachmentContentId()), anyObject())).willReturn(attachmentInfo);
User user = new User();
user.setId("admin@sw360.org");
user.setEmail("admin@sw360.org");
user.setFullname("John Doe");
given(this.userServiceMock.getUserByEmail("admin@sw360.org")).willReturn(user);
}
use of org.eclipse.sw360.datahandler.thrift.users.User in project sw360portal by sw360.
the class TestUtils method getAdminUser.
public static User getAdminUser(Class caller) {
User user = failingMock(User.class);
doReturn(true).when(user).isSetUserGroup();
doReturn(UserGroup.ADMIN).when(user).getUserGroup();
doReturn(true).when(user).isSetEmail();
doReturn(caller.getSimpleName() + "@tngtech.com").when(user).getEmail();
doReturn(true).when(user).isSetDepartment();
doReturn(caller.getPackage().getName()).when(user).getDepartment();
return user;
}
Aggregations