Re: [ANN] permissions - role & permission based access control

2016-10-15 Thread Torsten Uhlmann
@larry I added bitmask permissions to https://github.com/tuhlmann/permissions together with a set of unit tests and a description in Readme. Please have a look if you like. I don't think I will ever use it as I'm quiet content with the literal approach. But it was an interesting exercise to separa

Re: [ANN] permissions - role & permission based access control

2016-10-13 Thread adrian . medina
My suggestion of a bitmask was just a response to a suggestion of prime factorization for encoding roles in an integer. I think using a set is just fine. The space requirements for a small set of keywords is negligible in the larger scheme of things. It also permits more readable code (always a

Re: [ANN] permissions - role & permission based access control

2016-10-13 Thread Torsten Uhlmann
It might be premature optimization, or you could view it as a different approach, for a different usage scenario. I'm myself pretty content with the literal approach, we're using this in a fairly large application and haven't experienced any problems with regards of performance or amount of data at

Re: [ANN] permissions - role & permission based access control

2016-10-13 Thread Stefan Kamphausen
Hi, Doesn't that feel like premature optimization to you, too? Bitmasks are much harder to read than sets with spelled out roles and I wonder if the performance gain is really worth that. And it poses a limit of 64 roles. I have seen several enterprise applications that had far more than 64 r

Re: [ANN] permissions - role & permission based access control

2016-10-12 Thread Torsten Uhlmann
I see to add that feature over the weekend @larry. I'm using this role model together with the excellent buddy-auth library. larry google groups schrieb am Mi., 12. Okt. 2016 um 19:12 Uhr: > >That would only get 64 states into a 64 bit Long, but was always enough. > > The bitmask idea is good. I

Re: [ANN] permissions - role & permission based access control

2016-10-12 Thread larry google groups
>That would only get 64 states into a 64 bit Long, but was always enough. The bitmask idea is good. I agree there are always tradeoffs. A number is less readable, but more efficient. I would be happy if there was a small library that did just (roles/permissions), and which I could compose with

Re: [ANN] permissions - role & permission based access control

2016-10-11 Thread Torsten Uhlmann
Thanks for the comments! @larry I was reminded by your comment at how I used to use bitmasks before, like @adrian commented. That would only get 64 states into a 64 bit Long, but was always enough. I have no performance data on prime number sieves but I suspect that would take longer than checking

Re: [ANN] permissions - role & permission based access control

2016-10-11 Thread adrian . medina
If you wanted to do something more efficient, why not just use a bitmask? That is far more efficient than prime factorization. On Tuesday, October 11, 2016 at 12:06:19 AM UTC-4, larry google groups wrote: > > A minor pet peeve of mine, but is it possible to attach prime numbers to > the roles,

Re: [ANN] permissions - role & permission based access control

2016-10-10 Thread larry google groups
A minor pet peeve of mine, but is it possible to attach prime numbers to the roles, and to then decipher the roles from the factors of the total? Using strings or keywords for permissions often strikes me as inefficient. Assuming: create -- 2 read -- 3 update -- 5 delete -- 7 bulk-erase --