Discussion:
[pylons-discuss] Small bug in DummySecurityPolicy
Gerhard Schmidt
2018-11-11 12:24:50 UTC
Permalink
Hi,

I'm doing some tests writing for an project of mine and come to testing
permissions. I use DummySecurityPolicy in most of my tests to speedup
testing. But there is a small problem with the code.

DummySecurityPolicy.principals_allowed_by_permission() returns always
the result of DummySecurityPolicy.effective_principals() regardless if
permissive is True or False.

It should return [] if permissive is set to False.

So the code should look like this.

def principals_allowed_by_permission(self, context, permission):
if self.permissive:
return self.effective_principals(None)
else:
return []

Regards
Estartu
--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+***@googlegroups.com.
To post to this group, send email to pylons-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/46c5336e-ef8c-1ecc-d1c6-e900a461d545%40augusta.de.
For more options, visit https://groups.google.com/d/optout.
Steve Piercy
2018-11-14 13:48:30 UTC
Permalink
Please submit an issue or pull request.
https://github.com/Pylons/pyramid/issues/new/choose

--steve
Post by Gerhard Schmidt
I'm doing some tests writing for an project of mine and come to testing
permissions. I use DummySecurityPolicy in most of my tests to speedup
testing. But there is a small problem with the code.
DummySecurityPolicy.principals_allowed_by_permission() returns always
the result of DummySecurityPolicy.effective_principals() regardless if
permissive is True or False.
It should return [] if permissive is set to False.
So the code should look like this.
return self.effective_principals(None)
return []
------------------------
Steve Piercy, Eugene, OR
--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+***@googlegroups.com.
To post to this group, send email to pylons-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/r480Ps-10126i-CDEFC3CA1ADD45AA9601C3B271A6179D%40Steves-iMac.local.
For more options, visit https://groups.google.com/d/optout.
Loading...