From 034eae66f477d429d2900e060bac9795c4ff9487 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 16 Dec 2013 16:43:19 +0530 Subject: [PATCH] [minor] [fix] only for --- webnotes/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webnotes/__init__.py b/webnotes/__init__.py index cfd82cee66..677e9be363 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -252,10 +252,10 @@ def whitelist(allow_guest=False): def only_for(roles): if not isinstance(roles, (tuple, list)): roles = (roles,) - myroles = get_roles() - for role in roles: - if role not in myroles: - raise PermissionError + roles = set(roles) + myroles = set(get_roles()) + if not roles.intersection(myroles): + raise PermissionError class HashAuthenticatedCommand(object): def __init__(self):