MCPcopy Create free account
hub / github.com/codecombat/codecombat / hasPermission

Function hasPermission

app/lib/classroom-utils.js:6–11  ·  view source on GitHub ↗
(permission, { ownerId, permissions })

Source from the content-addressed store, hash-verified

4}
5
6export function hasPermission (permission, { ownerId, permissions }) {
7 if (me.id === ownerId) return true
8 if (me.isAdmin()) return true
9 if (permission !== 'read' && permission !== 'write') return false
10 return !!(permissions || []).find(p => p.target === me.id && p.access === permission)
11}
12
13export function hasSharedWriteAccessPermission (classroom) {
14 return (classroom.permissions || []).find((p) => p.target === me.get('_id') && p.access === 'write')

Callers

nothing calls this directly

Calls 1

isAdminMethod · 0.80

Tested by

no test coverage detected