-
Notifications
You must be signed in to change notification settings - Fork 4
Scope
Eric edited this page Jan 30, 2024
·
8 revisions
Scope is designed to test and verify a scope against an entity
OGX.Scope.eval(_SCOPE_EXPRESSION_, _SCOPE_);
A Scope Expression is a string that contains the testing part. For instance, if you wish to test an entity scope and check if it has the required scope:
OGX.Scope.eval('manager', entity.scope);
Consider the entity
let entity = {scope:'admin'};
You can test if the scope matches admin
const has_required_scope = OGX.Scope.eval('admin', entity.scope);
//true
Test if at least one scope matches,
admin
ormanager
const has_required_scope = OGX.Scope.eval('admin|manager', entity.scope);
//true
Test if at least the scope matches,
support
andcsuite
const has_required_scope = OGX.Scope.eval('support+csuite', entity.scope);
//false
You can also use regular expressions, such as
const has_required_scope = OGX.Scope.eval('/(cluster|company)_(admin|manager|support)/', entity.scope);
//false
- Welcome
- Changelog
- Structure
- Configuration
- Getting started
- CLI
- Poly
- Core
- Templating
- Routing
- Controllers
- Components
- Extra Components
- Helpers
- Styling
- Debugging