Skip to content

Commit

Permalink
🎨 R.OK() and R.NG()
Browse files Browse the repository at this point in the history
  • Loading branch information
trydofor committed Aug 24, 2023
1 parent ae7edc5 commit eb321a1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public class AdminController {
private WarlockUserAuthnService authnService;

@PostMapping("/admin/disable-root.json")
public R<Boolean> rootNeverLogin() {
public R<Void> rootNeverLogin() {
authnService.disable(DefaultUserId.Root, WarlockAuthType.USERNAME);
log.info("disable root");
return R.ok();
return R.OK;
}
}
2 changes: 1 addition & 1 deletion observe/mirana
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public ResponseEntity<R<?>> nonceCheck(@RequestHeader("token") String token, Htt
if (sid == null) {
return ResponseEntity
.status(HttpStatus.UNAUTHORIZED)
.body(R.ng());
.body(R.NG);
}
else {
final R<?> r;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static class Dto {
@PostMapping(value = "${" + WarlockUrlmapProp.Key$userAuthedUser + "}")
public R<Dto> authedUser(HttpServletRequest request) {
final WingsUserDetails wd = SecurityContextUtil.getUserDetails(false);
if (wd == null) return R.ng();
if (wd == null) return R.NG();

Dto dto = new Dto();
fillDetail(wd, dto);
Expand Down Expand Up @@ -136,7 +136,7 @@ public static class Ins {
@PostMapping(value = "${" + WarlockUrlmapProp.Key$userAuthedPerm + "}")
public R<Set<String>> authedPerm(HttpServletRequest request, @RequestBody Ins ins) {
final WingsUserDetails wd = SecurityContextUtil.getUserDetails(false);
if (wd == null) return R.ng();
if (wd == null) return R.NG();

final Set<String> ck = ins.getCheck();
final Set<String> pm = wd.getAuthorities().stream()
Expand All @@ -163,7 +163,7 @@ public R<Set<String>> authedPerm(HttpServletRequest request, @RequestBody Ins in
if (alias == null) alias = Collections.emptyMap();

if (perms.isEmpty() && alias.isEmpty()) {
return R.ok();
return R.OK();
}

// alias over perms
Expand Down Expand Up @@ -205,7 +205,7 @@ public static class Ses extends Dto {
@PostMapping(value = "${" + WarlockUrlmapProp.Key$userListSession + "}")
public R<List<Ses>> listSession() {
final WingsUserDetails details = SecurityContextUtil.getUserDetails(false);
if (details == null) return R.ng();
if (details == null) return R.NG();

final List<MapSession> sessions = wingsSessionHelper.findByUserId(details.getUserId());
final List<Ses> sess = sessions.stream().map(it -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ public R<?> watching() throws InterruptedException {
watchingService.asyncAwait();
watchingService.normalFetch();
watchingService.errorFetch();
return R.ok();
return R.OK;
}
}

0 comments on commit eb321a1

Please sign in to comment.