Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(369)  |  Call(167)  |  Derive(0)  |  Import(202)
Get a security manager, for the current thread.
    

        def getSecurityManager():
    """Get a security manager, for the current thread.
    """
    thread_id=get_ident()
    manager=_managers.get(thread_id, None)
    if manager is None:
        nobody = getattr(SpecialUsers, 'nobody', None)
        if nobody is None:
            # Initialize SpecialUsers by importing User.py.
            import User
            nobody = SpecialUsers.nobody
        manager = SecurityManager(thread_id, SecurityContext(nobody))
        _managers[thread_id]=manager

    return manager
        


src/e/r/erp5-HEAD/product/CMFActivity/ActivityTool.py   erp5(Download)
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.SecurityManagement import setSecurityManager
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.User import system as system_user
from Products.CMFCore.utils import UniqueObject, _getAuthenticatedUser
  def __call__(self, activity_tool):
    try:
      obj = self.getObject(activity_tool)
      if obj is not None:
        old_security_manager = getSecurityManager()
  def reactivate(self, activity_tool, activity=DEFAULT_ACTIVITY):
    # Reactivate the original object.
    obj = self._getObject(activity_tool)
    old_security_manager = getSecurityManager()
    try:
          # both setupCurrentSkin and REQUEST are acquired from containers.
          self.setupCurrentSkin(self.REQUEST)
          old_sm = getSecurityManager()
          try:
            # get owner of portal_catalog, so normally we should be able to

src/s/l/slapos.core-HEAD/master/bt5/slapos_cloud/ExtensionTemplateItem/SlapOSCloud.py   slapos.core(Download)
##############################################################################
 
from AccessControl.SecurityManagement import getSecurityManager, \
             setSecurityManager, newSecurityManager
from Products.ERP5Security.ERP5UserManager import SUPER_USER
  # micro security: can caller access software instance?
  software_instance = self.restrictedTraverse(relative_url)
  sm = getSecurityManager()
  if (software_instance.getPortalType() == "Slave Instance") and \
    (software_instance.getReference() == reference):

src/e/r/erp5-HEAD/product/ERP5Form/PreferenceTool.py   erp5(Download)
 
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager,\
                          setSecurityManager, newSecurityManager
from MethodObject import Method
    """
    tv = getTransactionalVariable()
    security_manager = getSecurityManager()
    user = security_manager.getUser()
    acl_users = self.getPortalObject().acl_users
  def createPreferenceForUser(self, username, enable=True):
    """Creates a preference for a given user, and optionnally enable the
    preference.
    """
    security_manager = getSecurityManager()

src/e/r/erp5-HEAD/product/ERP5eGovSecurity/EGOVUserManager.py   erp5(Download)
from Products.ERP5Type.Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager,\
    setSecurityManager, newSecurityManager
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
            user_portal_type = user.getPortalType()
 
            sm = getSecurityManager()
            if sm.getUser().getId() != SUPER_USER:
              newSecurityManager(self, self.getUser(SUPER_USER))
        def _getUserByLogin(login, exact_match):
          # because we aren't logged in, we have to create our own
          # SecurityManager to be able to access the Catalog
          sm = getSecurityManager()
          if sm.getUser().getId() != SUPER_USER:

src/e/r/erp5-HEAD/product/ERP5Wizard/PAS/ERP5RemoteUserManager.py   erp5(Download)
from Products.ERP5Type.Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager,\
    setSecurityManager, newSecurityManager
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
            user = user_list[0]
 
            sm = getSecurityManager()
            if sm.getUser().getId() != SUPER_USER:
              newSecurityManager(self, self.getUser(SUPER_USER))

src/e/r/erp5-HEAD/product/ERP5ShortMessage/Document/MobytGateway.py   erp5(Download)
from AccessControl import ClassSecurityInfo, \
                          Unauthorized 
from AccessControl.SecurityManagement import  getSecurityManager, \
                                              setSecurityManager, \
                                              newSecurityManager 
    def receive(self,REQUEST):
      """Receive push notification from the gateway"""
 
      #Get current user
      sm = getSecurityManager()

src/e/r/erp5-HEAD/product/ERP5ShortMessage/Document/EssendexGateway.py   erp5(Download)
from AccessControl import ClassSecurityInfo, \
                          Unauthorized 
from AccessControl.SecurityManagement import  getSecurityManager, \
                                              setSecurityManager, \
                                              newSecurityManager 
 
      #Get current user
      sm = getSecurityManager()
      try:
        #Use SUPER_USER

src/e/r/erp5-HEAD/product/ERP5ShortMessage/Document/DummyGateway.py   erp5(Download)
from AccessControl import ClassSecurityInfo, \
                          Unauthorized 
from AccessControl.SecurityManagement import  getSecurityManager, \
                                              setSecurityManager, \
                                              newSecurityManager 
    def receive(self,REQUEST):
      """Receive push notification from the gateway"""
 
      #Get current user
      sm = getSecurityManager()

src/e/r/erp5-HEAD/product/ERP5/Tool/InotifyTool.py   erp5(Download)
from Products.ERP5Type import Permissions
from Products.ERP5.mixin.timer_service import TimerServiceMixin
from AccessControl.SecurityManagement import newSecurityManager, \
  getSecurityManager, setSecurityManager
 
            if x.isEnabled() and current_node in x.getNodeList()]
        update_state_dict = {}
        original_security_manager = getSecurityManager()
        for notify_id in notify_list:
          notify = self._getOb(notify_id)

src/e/r/erp5-HEAD/product/ERP5/Tool/AlarmTool.py   erp5(Download)
 
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager, \
        newSecurityManager, setSecurityManager
from Products.ERP5Type.Globals import InitializeClass, DTMLFile, PersistentMapping
      if so then we will activate them.
    """
    security_manager = getSecurityManager()
    try:
      for alarm in self.getAlarmList(to_active=1):

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next