コード例 #1
0
ファイル: Survey.py プロジェクト: emieza/Products.PloneSurvey
    def createLocalPas(self):
        """Create PAS acl_users else login_form does not work"""
        # need Manager role to add an acl_users object
        remove_role = False
        if not getSecurityManager().checkPermission(permissions.ManagePortal, self):
            portal_membership = getToolByName(self, "portal_membership")
            current_user = portal_membership.getAuthenticatedMember()
            current_userid = current_user.getId()
            self.manage_addLocalRoles(userid=current_userid, roles=["Manager"])
            remove_role = True
        # Re-use code in PlonePAS install
        addPluggableAuthService(self)
        out = StringIO()
        try:
            challenge_chooser_setup(self)
        except TypeError:
            # BBB needed for Plone 3.3.5
            challenge_chooser_setup(self, out)
        registerPluginTypes(self.acl_users)
        try:
            setupPlugins(self)
        except TypeError:
            # BBB needed for Plone 3.3.5
            setupPlugins(self, out)

        # Recreate mutable_properties but specify fields
        uf = self.acl_users
        uf.manage_addProduct["PluggableAuthService"]
        plone_pas = uf.manage_addProduct["PlonePAS"]
        plone_pas.manage_delObjects("mutable_properties")
        plone_pas.manage_addZODBMutablePropertyProvider("mutable_properties", fullname="", key="", email_sent="")
        activatePluginInterfaces(self, "mutable_properties", out)
        if remove_role:
            self.manage_delLocalRoles(userids=[current_userid])
コード例 #2
0
ファイル: setuphandlers.py プロジェクト: dtgit/dtedu
def installPAS(portal):
    out = StringIO()

    # Add user folder
    portal.manage_addProduct["PluggableAuthService"].addPluggableAuthService()

    # Configure Challenge Chooser plugin if available
    challenge_chooser_setup(portal, out)

    # A bunch of general configuration settings
    registerPluginTypes(portal.acl_users)
    setupPlugins(portal, out)

    # TODO: This is highly questionable behaviour. Replacing the UF at the root.
    migrate_root_uf(portal, out)
コード例 #3
0
def installPAS(portal):
    # Add user folder
    portal.manage_addProduct['PluggableAuthService'].addPluggableAuthService()

    # Configure Challenge Chooser plugin if available
    challenge_chooser_setup(portal)

    # A bunch of general configuration settings
    registerPluginTypes(portal.acl_users)
    setupPlugins(portal)

    # XXX Why are we doing this?
    # According to Sidnei, "either cookie or basic auth for a user in the root folder doesn't work
    # if it's not a PAS UF when you sign in to Plone. IIRC."
    # See: http://twitter.com/#!/sidneidasilva/status/14030732112429056
    # And here's the original commit: 
    # http://dev.plone.org/collective/changeset/10720/PlonePAS/trunk/Extensions/Install.py
    migrate_root_uf(portal)
コード例 #4
0
    def createLocalPas(self):
        """Create PAS acl_users else login_form does not work"""
        # need Manager role to add an acl_users object
        remove_role = False
        if not getSecurityManager().checkPermission(permissions.ManagePortal,
                                                    self):
            portal_membership = getToolByName(self, 'portal_membership')
            current_user = portal_membership.getAuthenticatedMember()
            current_userid = current_user.getId()
            self.manage_addLocalRoles(userid=current_userid,
                                      roles=[
                                          'Manager',
                                      ])
            remove_role = True
        # Re-use code in PlonePAS install
        addPluggableAuthService(self)
        out = StringIO()
        try:
            challenge_chooser_setup(self)
        except TypeError:
            # BBB needed for Plone 3.3.5
            challenge_chooser_setup(self, out)
        registerPluginTypes(self.acl_users)
        try:
            setupPlugins(self)
        except TypeError:
            # BBB needed for Plone 3.3.5
            setupPlugins(self, out)

        # Recreate mutable_properties but specify fields
        uf = self.acl_users
        uf.manage_addProduct['PluggableAuthService']
        plone_pas = uf.manage_addProduct['PlonePAS']
        plone_pas.manage_delObjects('mutable_properties')
        plone_pas.manage_addZODBMutablePropertyProvider('mutable_properties',
                                                        fullname='',
                                                        key='',
                                                        email_sent='')
        activatePluginInterfaces(self, 'mutable_properties', out)
        if remove_role:
            self.manage_delLocalRoles(userids=[
                current_userid,
            ])