def listFacades(context=None): """ Provide a list of all known facades. """ if context is None: context = get_dmd() return sorted(str(name) for name, obj in component.getAdapters([context], IFacade))
def checkPermission(permission, context=None): """ Return true if the current user has the specified permission on the given context or the dmd; otherwise, return false. """ manager = AccessControl.getSecurityManager() context = context or get_dmd() return manager.checkPermission(permission, context)
def getFacade(name, context=None): """ Get facade by name. The names are documented in configure.zcml defined as utilities that provide subclasses of IFacade (all the subclasses follow the naming convention I*Facade). This function hides the use of Zope Component Architecture (ZCA) from the Ext Direct routers and other consumers of the Zuul Python API. """ if context is None: context = get_dmd() return component.getAdapter(context, IFacade, name)