I have been doing an authentcation package with signup and login/logout
features using PAU. When i refered to philips book and the worldcookery
example i found the following codes in the signup logic.

class SignUpView(BaseSignUpView):

    signUpForm = ViewPageTemplateFile('signup.pt')

    def signUp(self, login, title, password, confirmation):
        if confirmation != password:
            raise UserError(_(u"Password and confirmation didn't match"))
        folder = self._signupfolder()
        if login in folder:
            raise UserError(_(u"This login has already been chosen."))
        principal_id = folder.signUp(login, password, title)

        role_manager = IPrincipalRoleManager(self.context)

        role_manager = removeSecurityProxy(role_manager) # <- wot does it
really do and how does it make the newly

                   # created user to be authenticated automatically

        for role in folder.signup_roles:
            role_manager.assignRoleToPrincipal(role, principal_id)

The above logic works well for me too. But if i comment the line
'role_manager = removeSecurityProxy(role_manager)',still user creation and
role assignment works. but i am asked to login again right after the signup.
and the redirect does not work.

And another apporch i have seen in


so i tried to set the principal as


and commented the removeSecurityProxy line.
But it also gives same result.

So is there any other way than using removeSecurityProxy(role_manager)? I
also would like to know how risky it can be to use removeSecurityProxy in a
code with public (zope.public) permission. I Know this is very trivial issue
and everyone have gone through this once.

Thanks in advance.
Zope3-users mailing list

Reply via email to