diff --git a/server/routes/rooms.js b/server/routes/rooms.js
index d159d50..6ebbc78 100644
--- a/server/routes/rooms.js
+++ b/server/routes/rooms.js
@@ -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' });
diff --git a/src/pages/RoomDetail.jsx b/src/pages/RoomDetail.jsx
index 52d8829..39322f7 100644
--- a/src/pages/RoomDetail.jsx
+++ b/src/pages/RoomDetail.jsx
@@ -62,7 +62,10 @@ export default function RoomDetail() {
const isOwner = room && user && room.user_id === user.id;
const isShared = room && !!room.shared;
+ const isAdmin = user?.role === 'admin';
const canManage = isOwner || isShared;
+ const canStart = canManage || isAdmin || !!room?.anyone_can_start;
+ const canEnd = canManage || isAdmin;
const fetchRoom = async () => {
try {
@@ -452,7 +455,7 @@ export default function RoomDetail() {
{t('federation.inviteRemote')}
)}
- {canManage && !status.running && !waitingToJoin && (
+ {canStart && !status.running && !waitingToJoin && (
- {canManage && status.running && (
+ {canEnd && status.running && (