Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"site administrator" role has no permissions #5

Open
fulv opened this issue Dec 3, 2012 · 6 comments
Open

"site administrator" role has no permissions #5

fulv opened this issue Dec 3, 2012 · 6 comments

Comments

@fulv
Copy link
Member

fulv commented Dec 3, 2012

Now that there is the useful "site administrator" role, it would be great if it had access to the control panel. Unfortunately, the permission "cmf.ManagePortal" is used in several places, so it can't even be overridden in the ZMI.

@davisagli
Copy link
Member

It should be fine to change that to a more specific permission that is assigned to the Manager and Site Administrator roles. Can you make a pull request?

@fulv
Copy link
Member Author

fulv commented Dec 3, 2012

Although, what about older Plone versions where there is no Site Administrator role? Not sure how to handle that.

@davisagli
Copy link
Member

If you set the roles using CMFCore.utils.setDefaultRoles instead of in rolemap.xml it should be okay -- setDefaultRoles doesn't validate the roles that are specified in any way.

@fulv
Copy link
Member Author

fulv commented Dec 4, 2012

You mean in a "setupVarious"-type importStep? The product doesn't have one (except for the importAnalyticsReportStep), so I'd have to add it.

I'm not familiar with CMFCore.utils.setDefaultRoles. Are you saying that if I installed it on Plone 4.0, the call

setDefaultRoles( "Google Analytics: Manage Analytics Reports", ( 'Manager', 'Site Administrator' ) )

would be equivalent to

setDefaultRoles( "Google Analytics: Manage Analytics Reports", ( 'Manager', ) )

?

I guess I should try it.

@fulv
Copy link
Member Author

fulv commented Dec 4, 2012

No dice. I tried adding this to exportimport.py, as well as the corresponding zcml:

def setupVarious(context):
    """
    Various import steps that are not handled by GS import/export handlers.
    """
    from Products.CMFCore.permissions import setDefaultRoles
    setDefaultRoles( 'Google Analytics: View Analytics Results', 
                    ( 'Site Administrator', ) )
    setDefaultRoles( 'Google Analytics: Manage Analytics Reports', 
                    ( 'Site Administrator', ) )

I'm not sure how this is supposed to work. In CMFCore.permissions.setDefaultRoles, the first thing it does is to check

if perm in _registeredPermissions:
    return

And since the permission is declared in the main configure.zcml, it just returns and doesn't do anything.

@davisagli
Copy link
Member

You have to put setDefaultRoles in init.py outside of any function, so that it runs early during Zope startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants