1 /// NOTE: These permissions are for UI cosmetics only!
2 /// They should be in sync with the backend Policies.
4 export const isAdmin = user => user && user.role === 'admin';
6 export const isSameUser = (user, subject) => user && subject && user.id === subject.id;
10 export const isParticipant = (user, tournament) =>
11 user && tournament && tournament.participants &&
12 tournament.participants.find(p => p.user && p.user.id == user.id);
14 export const mayAddRounds = (user, tournament) =>
15 isAdmin(user) || isParticipant(user, tournament);
17 export const mayViewProtocol = user =>