cleaned the services
This commit is contained in:
@@ -46,7 +46,7 @@ public class CourseController {
|
||||
@RequestBody Course course)
|
||||
{
|
||||
|
||||
if (authServ.IsNotIn(new Role[]{Role.Secretary,Role.Admin},token))
|
||||
if (authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
return new ResponseEntity<>(courseServ.save(course), HttpStatus.CREATED);
|
||||
@@ -59,15 +59,15 @@ public class CourseController {
|
||||
@PathVariable long id)
|
||||
{
|
||||
|
||||
if (authServ.IsNotIn(new Role[]{Role.Admin,Role.Teacher,Role.Secretary}, token))
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher,Role.Secretary}, token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
Course modifiedCourse = courseServ.modifyData(id,updates,authServ.getUserFromToken(token).getRole());
|
||||
|
||||
if (modifiedCourse == null)
|
||||
|
||||
if (!courseServ.modifyData(id, updates, authServ.getUserFromToken(token).getRole()))
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
return new ResponseEntity<>(modifiedCourse, HttpStatus.OK);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/course/{id}")
|
||||
@@ -76,7 +76,7 @@ public class CourseController {
|
||||
@PathVariable Long id)
|
||||
{
|
||||
|
||||
if (authServ.IsNotIn(new Role[]{Role.Admin,Role.Secretary}, token))
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary}, token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user