DW: Added datadictionary permissions and checked role using issubset of the...

... configured permission
In the example you gave "a" is a (strict) subset of "b" so it should work
for that case.

Unless there's something else complicating it.
On Sep 17, 2014 12:03 PM, "ukanga" <notifications@github.com> wrote:

> In onadata/libs/permissions.py:
>
> > @@ -59,7 +63,8 @@ def has_role(cls, permissions, obj):
> >          :param permissions: A list of permissions.
> >          :param obj: An object to get the permissions of.
> >          """
> > -        return set(permissions) == set(cls.class_to_permissions[type(obj)])
> > +        return all([l in set(permissions)
>
> It does not work, Dennis had the issubset implementation which failed.
> Consider a a = [1, 4, 5, 7] and b = [3, 4, 1, 5, 7, 9], if a is the
> permissions for the role, and b are the list of object permissions passed
> in for the check, we need to ensure that b has all a permissions.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/onaio/onadata/pull/545/files#r17673666>.
>