[Building Sakai] Question about sakai functions (i.e. permissions)

Jim Eng jimeng at umich.edu
Thu Mar 15 11:56:36 PDT 2012


Thanks, Matthew.  I'd guess we will probably never need a permission name longer than 99 characters.    

We will be starting with a String array as the list of permissions. I think a safe way to store it is to convert it to a JSON array and story the string representation of that.  Then it's easy to convert it back to an array of Strings, and the JSON library takes care of escaping and unescaping anything that needs to be escaped. 

For our code, we can set arbitrary limits on the length of permission strings (99 characters) and on number of permissions that can be checked (4?), and then we can use an arbitrary column width (500 characters?).   

Jim


On Mar 15, 2012, at 1:40 PM, Matthew Jones wrote:

> I'm not sure either. I wonder why it was 99. Maybe it was a long day and Glenn was counting down bottles of beer on the wall? ;) I know for old versions of mysql, varchar 255 made sense and some other values in the realms like REALM_ID are 255. It doesn't even seem like it would make work for utf8 any better. Perhaps slightly more efficient queries or slightly less space in the cache, but that probably doesn't matter too much anymore.
> 
> I personally don't see any problem with you introducing a new delimiter and/or even increasing the size of this column up to the old mysql varchar length of 255. (If needed) I can't find anything in the code under quick check that would limit this function name to [a-zA-Z.] and can't think of anything if unless you chose a non ascii character as the delimiter?
> 
> On Thu, Mar 15, 2012 at 1:05 PM, Jim Eng <jimeng at umich.edu> wrote:
> The names (or identifiers?) for permissions in sakai seem to be strings made up of alphabetic characters (mostly lower-case?) and dots (like the one at the end of this sentence).  They also seem to be pretty short, usually no more than 20 or 30 characters.  For example, "content.read" or "annc.delete.own" are two permissions used in sakai core.
> 
> The characteristics I mentioned seem to be conventions rather than requirements.  I don't see any documentation for any rules about what characters are valid/invalid or restrictions on length.    I am wondering whether there is anybody knows if there are any.
> 
> I am asking because I need to store a short list of permissions in the database, and it would be easier to store them in a delimited string rather than storing them individually.  But I'd want to make sure the delimiter would never be used in a permission id and that the database column is big enough to store the entire string.
> 
> It looks like function names are limited to 99 characters in the SAKAI_REALM_FUNCTION table, but I'm not sure that is guaranteed elsewhere.
> 
> Suggestions appreciated.
> 
> Thanks.
> 
> Jim
> 
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120315/819cf6ef/attachment.html 


More information about the sakai-dev mailing list