fix: anyone_can_start not working as Admin
Build & Push Docker Image / build (push) Successful in 4m24s
Build & Push Docker Image / build (push) Successful in 4m24s
This commit is contained in:
@@ -485,9 +485,10 @@ router.post('/:uid/start', authenticateToken, async (req, res) => {
|
||||
return res.status(404).json({ error: 'Room not found' });
|
||||
}
|
||||
|
||||
// Check access: owner or shared
|
||||
// Check access: owner, admin, shared, or anyone_can_start
|
||||
const isOwner = room.user_id === req.user.id;
|
||||
if (!isOwner) {
|
||||
const isAdmin = req.user.role === 'admin';
|
||||
if (!isOwner && !isAdmin && !room.anyone_can_start) {
|
||||
const share = await db.get('SELECT id FROM room_shares WHERE room_id = ? AND user_id = ?', [room.id, req.user.id]);
|
||||
if (!share) {
|
||||
return res.status(403).json({ error: 'No permission' });
|
||||
@@ -559,9 +560,10 @@ router.post('/:uid/end', authenticateToken, async (req, res) => {
|
||||
return res.status(404).json({ error: 'Room not found' });
|
||||
}
|
||||
|
||||
// Check access: owner or shared user
|
||||
// Check access: owner, admin, or shared user
|
||||
const isOwner = room.user_id === req.user.id;
|
||||
if (!isOwner) {
|
||||
const isAdmin = req.user.role === 'admin';
|
||||
if (!isOwner && !isAdmin) {
|
||||
const share = await db.get('SELECT id FROM room_shares WHERE room_id = ? AND user_id = ?', [room.id, req.user.id]);
|
||||
if (!share) {
|
||||
return res.status(403).json({ error: 'No permission' });
|
||||
|
||||
Reference in New Issue
Block a user