Skip to content

Permission checks for change_override_url_urlnode and change_shared_fields_urlnode are broken. #117

Open
@mrmachine

Description

@mrmachine

def has_change_shared_fields_permission(self, request, obj=None):
"""
Whether the user can change the page layout.
"""
opts = self.opts
codename = '{0}.change_shared_fields_urlnode'.format(opts.app_label)
return request.user.has_perm(codename, obj=obj)
def has_change_override_url_permission(self, request, obj=None):
"""
Whether the user can change the page layout.
"""
opts = self.opts
codename = '{0}.change_override_url_urlnode'.format(opts.app_label)
return request.user.has_perm(codename, obj=obj)

These checks are triggered on page types (polymorphic child models) where self.opts.app_label is something other than fluent_pages. But the permissions are only created for UrlNode model (which belongs to fluent_pages app).

permissions = (
('change_shared_fields_urlnode', _("Can change Shared fields")), # The fields shared between languages.
('change_override_url_urlnode', _("Can change Override URL field")), # Fpr overriding URLs (e.g. '/' for homepage).
)

It looks like this has been the case for a long long time. I can only guess that it has never been noticed because everyone is using superuser accounts (which have all permissions, even permissions that don't exist).

Or perhaps another more recent change has only recently surfaced the issue. When I try to create a page with a staff account, I am told to fix the errors below (but there are none). I assume the error is that the read only override_url field is (None) instead of an empty string, and because it's read only, no field is shown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions