Page tree
Skip to end of metadata
Go to start of metadata

virtual void FB::JSAPIImpl::pushZone ( const SecurityZone securityLevel)
inlinevirtual

Pushes a new security level and locks a mutex (for every Push there must be a Pop!)

This should be used to temporarily set the security zone of the API object. Note that this also locks a mutex to ensure that access to members under a non-default security level is serialized. Do not ever leave an unmatched push (a push with no pop after it). For safety, use the helper FB::scoped_zonelock:

// In the constructor
// Register protected members
{
FB::scoped_zonelock _l(this, SecurityScope_Protected);
registerMethod("start", make_method(this, &MyPluginAPI::start));
} // Zone automatically popped off
// Register private members
{
FB::scoped_zonelock _l(this, SecurityScope_Protected);
registerMethod("getDirectoryListing", make_method(this, &MyPluginAPI::getDirectoryListing));
} // Zone automatically popped off
Parameters
securityLevelconst SecurityZone & Zone id to push on the stack
Since
1.4a3
See Also
FB::scoped_zonelock

Reimplemented from FB::JSAPI.

Definition at line 176 of file JSAPIImpl.h.

177  {
178  m_zoneMutex.lock();
179  m_zoneStack.push_back(securityLevel);
180  }
  • No labels