chore: drop demo-user permission (#2045)
This commit is contained in:
@@ -59,7 +59,6 @@ public enum ApiError {
|
||||
TASK_NOT_FOUND(HttpStatus.NOT_FOUND, "Scheduled task not found: %s"),
|
||||
TASK_ALREADY_RUNNING(HttpStatus.CONFLICT, "Task is already running: %s"),
|
||||
ICON_ALREADY_EXISTS(HttpStatus.CONFLICT, "SVG icon with name '%s' already exists"),
|
||||
DEMO_USER_PASSWORD_CHANGE_NOT_ALLOWED(HttpStatus.FORBIDDEN, "Demo user password change not allowed."),
|
||||
PERMISSION_DENIED(HttpStatus.FORBIDDEN, "Permission denied: %s"),
|
||||
LIBRARY_PATH_NOT_ACCESSIBLE(HttpStatus.SERVICE_UNAVAILABLE, "Library scan aborted: path not accessible or empty: %s"),
|
||||
FORMAT_NOT_ALLOWED(HttpStatus.BAD_REQUEST, "File format '%s' is not allowed in library '%s'"),
|
||||
|
||||
@@ -91,10 +91,6 @@ public class UserPermissionsEntity {
|
||||
@Builder.Default
|
||||
private boolean permissionManageFonts = false;
|
||||
|
||||
@Column(name = "permission_demo_user", nullable = false)
|
||||
@Builder.Default
|
||||
private boolean permissionDemoUser = false;
|
||||
|
||||
@Column(name = "permission_bulk_auto_fetch_metadata", nullable = false)
|
||||
@Builder.Default
|
||||
private boolean permissionBulkAutoFetchMetadata = false;
|
||||
|
||||
@@ -22,8 +22,7 @@ public enum PermissionType {
|
||||
ACCESS_TASK_MANAGER("permissionAccessTaskManager"),
|
||||
MANAGE_GLOBAL_PREFERENCES("permissionManageGlobalPreferences"),
|
||||
MANAGE_ICONS("permissionManageIcons"),
|
||||
MANAGE_FONTS("permissionManageFonts"),
|
||||
DEMO_USER("permissionDemoUser");
|
||||
MANAGE_FONTS("permissionManageFonts");
|
||||
|
||||
private final String entityField;
|
||||
|
||||
|
||||
@@ -167,10 +167,6 @@ public class UserService {
|
||||
BookLoreUserEntity bookLoreUserEntity = userRepository.findByIdWithPermissions(bookLoreUser.getId())
|
||||
.orElseThrow(() -> ApiError.USER_NOT_FOUND.createException(bookLoreUser.getId()));
|
||||
|
||||
if (bookLoreUserEntity.getPermissions().isPermissionDemoUser()) {
|
||||
throw ApiError.DEMO_USER_PASSWORD_CHANGE_NOT_ALLOWED.createException();
|
||||
}
|
||||
|
||||
if (!passwordEncoder.matches(changePasswordRequest.getCurrentPassword(), bookLoreUserEntity.getPasswordHash())) {
|
||||
throw ApiError.PASSWORD_INCORRECT.createException();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ public class UserPermissionUtils {
|
||||
case MANAGE_ICONS -> perms.isPermissionManageIcons();
|
||||
case MANAGE_FONTS -> perms.isPermissionManageFonts();
|
||||
case MANAGE_GLOBAL_PREFERENCES -> perms.isPermissionManageGlobalPreferences();
|
||||
case DEMO_USER -> perms.isPermissionDemoUser();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -52,7 +51,6 @@ public class UserPermissionUtils {
|
||||
case MANAGE_ICONS -> perms.isCanManageIcons();
|
||||
case MANAGE_FONTS -> perms.isCanManageFonts();
|
||||
case MANAGE_GLOBAL_PREFERENCES -> perms.isCanManageGlobalPreferences();
|
||||
case DEMO_USER -> perms.isDemoUser();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user