Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

[RFC] new api.groups decorator #7

Open
legalsylvain opened this issue Oct 31, 2017 · 3 comments
Open

[RFC] new api.groups decorator #7

legalsylvain opened this issue Oct 31, 2017 · 3 comments
Labels

Comments

@legalsylvain
Copy link

legalsylvain commented Oct 31, 2017

Implementation

def groups(*groups):
    # check if current user are member of one of the given groups.
    # If not, raise an error. "To do this action, you should be member of ..."

Call sample

@oca.decorators.groups('group_1', 'group_2', '...')
def function_name(self, args):
    # custom action

Main interest

The check will be done if function is called by

  • (1) another function,
  • (2) an xml-rpc call,
  • (3) a button in a view. (<button name='function_name' />)

So it is a more secured approach that writing <button name='function_name' groups='group_xml_id'/> that does'nt prevent for the time being case 1 or 2.

Ref of the previous discussion

OCA/server-tools#944

CC : @NL66278, @ lasley, @pedrobaeza

@lasley
Copy link
Contributor

lasley commented Dec 19, 2017

Hey @legalsylvain - any updates on this?

@legalsylvain
Copy link
Author

No update !

Sorry, no time in the next weeks. (and maybe months...)
@lasley, @other, feel free to make a PoC, I review it with pleasure.

kind regards.

@lasley
Copy link
Contributor

lasley commented Dec 20, 2017

Thanks for the update @legalsylvain. I, too, am super busy - so probably won't have time in the near future either. I've been working on a project with some high test times recently, so have been trying to perform some OCA repo maintenance while waiting for test results (hence my comment) 🚀

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

No branches or pull requests

2 participants