import {organisationSubject} from './official-account.mjs'; export async function canRunScheduler(central,user){ if(!central||!user?.id)return false; const subject=await organisationSubject(central,user.id); const row=await central.prepare("SELECT p.principal_kind FROM org_control_principals p JOIN site_accounts a ON a.id=p.user_id WHERE p.user_id=? AND a.password_hash NOT LIKE '!%'").bind(subject.userId).first(); return ['owner','executive','service'].includes(row?.principal_kind); }