Skip to content

[RFC] new api.groups decorator for function #944

@legalsylvain

Description

@legalsylvain

Hi all,

I think about a new decorator like

@api.groups('group_1', 'group_2', '...')
def function_name(self, args):
    ...

to decorate function that are call by function in a xml file like <button name='function_name' />.

The decorator will check if current user is a member of one of the defined groups, if not an access error is raised. Then, in the render view, the button is hidden if the user is not a member of the defined groups automatically

That new decorator could fix security breaches that allow user to call a function of a hidden button, by xml RPC.

In a second time we could imagine other decorators @api.add_groups or @api.remove_groups to add or remove access to a function, in a custom module that inherit a model.

Thanks for your comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions