-
Notifications
You must be signed in to change notification settings - Fork 98
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
Conversation
e184423
to
92e9378
Compare
@@ -158,4 +158,12 @@ private HalResource<License> createHalLicense(License sw360License) { | |||
} | |||
return halLicense; | |||
} | |||
|
|||
@PreAuthorize("hasAuthority('WRITE')") | |||
@RequestMapping(value = LICENSES_URL + "/delete", method = RequestMethod.DELETE) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove unnecessary imports.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
While testing one license is not getting deleted. |
dd26c70
to
b5529aa
Compare
|
public void deleteAllLicenseInfo(User user) throws TException { | ||
LicenseService.Iface sw360LicenseClient = getThriftLicenseClient(); | ||
if (PermissionUtils.isUserAtLeast(UserGroup.ADMIN, user)) { | ||
RequestSummary deleteLicenseStatus = sw360LicenseClient.deleteAllLicenseInformation(user); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Signed-off-by: Nikesh kumar <[email protected]>
b5529aa
to
7c8f8d2
Compare
code looks good. |
Issue: #2064
Create a new rest endpoint to delete all license information in admin tab
Suggest Reviewer
How To Test?
1: http://localhost:8080/resource/api/licenses/delete
2: login with admin user and create token
3: use token in postman.
Checklist
Must: