Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rest):new endpoint to delete all license information in admin tab #2060

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

nikkuma7
Copy link
Contributor

@nikkuma7 nikkuma7 commented Jul 24, 2023

Please provide a summary of your changes here.

  • Which issue is this pull request belonging to and how is it solving it? (Refer to issue here)
  • Did you add or update any new dependencies that are required for your change?

Issue: #2064
Create a new rest endpoint to delete all license information in admin tab

Suggest Reviewer

You can suggest reviewers here with an @mention.

How To Test?

1: http://localhost:8080/resource/api/licenses/delete
2: login with admin user and create token
3: use token in postman.

How should these changes be tested by the reviewer?
Have you implemented any additional tests?

Checklist

Must:

  • All related issues are referenced in commit messages and in PR

@ag4ums ag4ums added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for New-UI Level for the API and UI level changes for the new-ui REST WIP work in progress labels Jul 24, 2023
@nikkuma7 nikkuma7 force-pushed the fix/deletealllicenseinfo branch 2 times, most recently from e184423 to 92e9378 Compare July 26, 2023 05:34
@ag4ums ag4ums removed the WIP work in progress label Jul 26, 2023
@rudra-superrr rudra-superrr self-assigned this Jul 26, 2023
@@ -158,4 +158,12 @@ private HalResource<License> createHalLicense(License sw360License) {
}
return halLicense;
}

@PreAuthorize("hasAuthority('WRITE')")
@RequestMapping(value = LICENSES_URL + "/delete", method = RequestMethod.DELETE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the endpoint to /deleteAll.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

import org.eclipse.sw360.datahandler.thrift.SW360Exception;
import org.eclipse.sw360.datahandler.thrift.licenses.License;
import org.eclipse.sw360.datahandler.thrift.licenses.Obligation;
import org.eclipse.sw360.datahandler.thrift.licenses.LicenseService;
import org.eclipse.sw360.datahandler.thrift.users.User;
import org.eclipse.sw360.datahandler.thrift.users.UserGroup;
import org.eclipse.sw360.datahandler.thrift.vendors.Vendor;
import org.eclipse.sw360.datahandler.thrift.vendors.VendorService;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove unnecessary imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

public void deleteAllLicenseInfo(User user) throws TException {
LicenseService.Iface sw360LicenseClient = getThriftLicenseClient();
if(PermissionUtils.isUserAtLeast(UserGroup.ADMIN, user)){
RequestSummary deleteLicenseStatus = sw360LicenseClient.deleteAllLicenseInformation(user);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use proper spacing for if condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@rudra-superrr
Copy link
Contributor

While testing one license is not getting deleted.

@nikkuma7 nikkuma7 force-pushed the fix/deletealllicenseinfo branch 2 times, most recently from dd26c70 to b5529aa Compare July 31, 2023 06:19
@nikkuma7
Copy link
Contributor Author

While testing one license is not getting deleted.

@nikkuma7 nikkuma7 closed this Jul 31, 2023
@nikkuma7 nikkuma7 reopened this Jul 31, 2023
public void deleteAllLicenseInfo(User user) throws TException {
LicenseService.Iface sw360LicenseClient = getThriftLicenseClient();
if (PermissionUtils.isUserAtLeast(UserGroup.ADMIN, user)) {
RequestSummary deleteLicenseStatus = sw360LicenseClient.deleteAllLicenseInformation(user);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use proper indentation on line 84

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@rudra-superrr
Copy link
Contributor

code looks good.

@rudra-superrr rudra-superrr added ready ready to merge and removed needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Aug 3, 2023
@ag4ums ag4ums merged commit 7177fc8 into eclipse-sw360:main Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New-UI Level for the API and UI level changes for the new-ui ready ready to merge REST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants