MCPcopy Index your code
hub / github.com/codecombat/codecombat / hasReadAccess

Method hasReadAccess

app/models/CocoModel.js:374–387  ·  view source on GitHub ↗
(actor)

Source from the content-addressed store, hash-verified

372 }
373
374 hasReadAccess (actor) {
375 // actor is a User object
376 let left
377 if (actor == null) { actor = me }
378 if (actor.isAdmin()) { return true }
379 if (actor.isArtisan() && this.editableByArtisans) { return true }
380 for (const permission of Array.from(((left = this.get('permissions', true)) != null ? left : []))) {
381 if ((permission.target === 'public') || (actor.get('_id') === permission.target)) {
382 if (['owner', 'read'].includes(permission.access)) { return true }
383 }
384 }
385
386 return false
387 }
388
389 hasWriteAccess (actor) {
390 // actor is a User object

Callers

nothing calls this directly

Calls 3

getMethod · 0.95
isAdminMethod · 0.80
isArtisanMethod · 0.80

Tested by

no test coverage detected