nullify this duplicate code prior to deletion.

This commit is contained in:
Brian O'Reilly 2025-10-03 13:14:04 -04:00
parent dee883e76e
commit ce39a0ca1a
1 changed files with 18 additions and 18 deletions

View File

@ -21,25 +21,25 @@
(defparameter *supported-formats* '("mp3" "flac" "ogg" "wav"))
;; Authentication functions
(defun require-authentication ()
"Require user to be authenticated"
(handler-case
(unless (session:field "user-id")
(radiance:redirect "/asteroid/login"))
(error (e)
(format t "Authentication error: ~a~%" e)
(radiance:redirect "/asteroid/login"))))
;; ;; Authentication functions
;; (defun require-authentication ()
;; "Require user to be authenticated"
;; (handler-case
;; (unless (session:field "user-id")
;; (radiance:redirect "/asteroid/login"))
;; (error (e)
;; (format t "Authentication error: ~a~%" e)
;; (radiance:redirect "/asteroid/login"))))
(defun require-role (role)
"Require user to have a specific role"
(handler-case
(let ((current-user (get-current-user)))
(unless (and current-user (user-has-role-p current-user role))
(radiance:redirect "/asteroid/login")))
(error (e)
(format t "Role check error: ~a~%" e)
(radiance:redirect "/asteroid/login"))))
;; (defun require-role (role)
;; "Require user to have a specific role"
;; (handler-case
;; (let ((current-user (get-current-user)))
;; (unless (and current-user (user-has-role-p current-user role))
;; (radiance:redirect "/asteroid/login")))
;; (error (e)
;; (format t "Role check error: ~a~%" e)
;; (radiance:redirect "/asteroid/login"))))
;; API Routes
(define-page admin-scan-library #@"/admin/scan-library" ()