Re: Composable permissions question

2019-02-26 Thread Frank Bohnsack
Thanks Xavier, makes sense.

Frank

Am Freitag, 22. Februar 2019 11:11:20 UTC+1 schrieb Xavier Ordoquy:
>
> Hi,
>
> We might do that but handling None a is side effect that is not supported.
> Documentation (
> https://www.django-rest-framework.org/api-guide/permissions/#custom-permissions)
>  
> says:
>
> The methods should return True if the request should be granted access, 
> and False otherwise.
>
> Regards,
> Xavier Ordoquy
>
>
> Le 22 févr. 2019 à 08:43, Frank Bohnsack  > a écrit :
>
> One question again:
>
> earlier versions of DRF permissions does support None returns values as 
> well and handles None like False. The New composable permissions will raise 
> an error here:
>
> unsupported operand type(s) for &: 'bool' and 'NoneType'
>
>
> Would it be possible to add None support again?
>
> Regards
> Frank
>
> Am Mittwoch, 31. Oktober 2018 19:49:38 UTC+1 schrieb Frank Bohnsack:
>>
>> While trying out the new composable permission feature, I have the 
>> following problem:
>>
>> >>> IsAuthenticated & IsStaff | IsAuthenticatedWithTwoFactor & IsCustomer
>> Traceback (most recent call last):
>>   File "/usr/lib/python3.6/code.py", line 91, in runcode
>> exec(code, self.locals)
>>   File "", line 1, in 
>> TypeError: unsupported operand type(s) for |: 'OperandHolder' and 
>> 'OperandHolder'
>> >>> 
>>
>> It seems that is posible to compose like 
>>
>> (IsAuthenticated | IsStaff) & IsAuthenticatedWithTowFactor
>>
>> but compose two composed permissions will not work :-(
>>
>> Is it a feature or whats wrong in my code?
>>
>> Regards
>> Frank
>>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-rest-framework+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Composable permissions question

2019-02-22 Thread Xavier Ordoquy
Hi,

We might do that but handling None a is side effect that is not supported.
Documentation 
(https://www.django-rest-framework.org/api-guide/permissions/#custom-permissions)
 says:

The methods should return True if the request should be granted access, and 
False otherwise.


Regards,
Xavier Ordoquy


> Le 22 févr. 2019 à 08:43, Frank Bohnsack  a écrit :
> 
> One question again:
> 
> earlier versions of DRF permissions does support None returns values as well 
> and handles None like False. The New composable permissions will raise an 
> error here:
> 
> unsupported operand type(s) for &: 'bool' and 'NoneType'
> 
> Would it be possible to add None support again?
> 
> Regards
> Frank
> 
> Am Mittwoch, 31. Oktober 2018 19:49:38 UTC+1 schrieb Frank Bohnsack:
> While trying out the new composable permission feature, I have the following 
> problem:
> 
> >>> IsAuthenticated & IsStaff | IsAuthenticatedWithTwoFactor & IsCustomer
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/code.py", line 91, in runcode
> exec(code, self.locals)
>   File "", line 1, in 
> TypeError: unsupported operand type(s) for |: 'OperandHolder' and 
> 'OperandHolder'
> >>>
> 
> It seems that is posible to compose like 
> 
> (IsAuthenticated | IsStaff) & IsAuthenticatedWithTowFactor
> 
> but compose two composed permissions will not work :-(
> 
> Is it a feature or whats wrong in my code?
> 
> Regards
> Frank
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-rest-framework+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Composable permissions question

2018-10-31 Thread Frank Bohnsack
Will do so.

Regards
Frank

Am Mittwoch, 31. Oktober 2018 22:07:18 UTC+1 schrieb Xavier Ordoquy:
>
> Hi,
>
> It’s more a bug in DRF.
> Could you open an issue about that so we can keep it on our radars ?
>
> Regards,
> Xavier,
> Linovia.
>
> Le 31 oct. 2018 à 19:49, Frank Bohnsack  > a écrit :
>
> While trying out the new composable permission feature, I have the 
> following problem:
>
> >>> IsAuthenticated & IsStaff | IsAuthenticatedWithTwoFactor & IsCustomer
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/code.py", line 91, in runcode
> exec(code, self.locals)
>   File "", line 1, in 
> TypeError: unsupported operand type(s) for |: 'OperandHolder' and 
> 'OperandHolder'
> >>> 
>
> It seems that is posible to compose like 
>
> (IsAuthenticated | IsStaff) & IsAuthenticatedWithTowFactor
>
> but compose two composed permissions will not work :-(
>
> Is it a feature or whats wrong in my code?
>
> Regards
> Frank
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-rest-framework+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Composable permissions question

2018-10-31 Thread Xavier Ordoquy
Hi,

It’s more a bug in DRF.
Could you open an issue about that so we can keep it on our radars ?

Regards,
Xavier,
Linovia.

> Le 31 oct. 2018 à 19:49, Frank Bohnsack  a écrit :
> 
> While trying out the new composable permission feature, I have the following 
> problem:
> 
> >>> IsAuthenticated & IsStaff | IsAuthenticatedWithTwoFactor & IsCustomer
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/code.py", line 91, in runcode
> exec(code, self.locals)
>   File "", line 1, in 
> TypeError: unsupported operand type(s) for |: 'OperandHolder' and 
> 'OperandHolder'
> >>>
> 
> It seems that is posible to compose like 
> 
> (IsAuthenticated | IsStaff) & IsAuthenticatedWithTowFactor
> 
> but compose two composed permissions will not work :-(
> 
> Is it a feature or whats wrong in my code?
> 
> Regards
> Frank
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-rest-framework+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Composable permissions question

2018-10-31 Thread Frank Bohnsack
While trying out the new composable permission feature, I have the 
following problem:

>>> IsAuthenticated & IsStaff | IsAuthenticatedWithTwoFactor & IsCustomer
Traceback (most recent call last):
  File "/usr/lib/python3.6/code.py", line 91, in runcode
exec(code, self.locals)
  File "", line 1, in 
TypeError: unsupported operand type(s) for |: 'OperandHolder' and 
'OperandHolder'
>>> 

It seems that is posible to compose like 

(IsAuthenticated | IsStaff) & IsAuthenticatedWithTowFactor

but compose two composed permissions will not work :-(

Is it a feature or whats wrong in my code?

Regards
Frank

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.