Lun 1563

Make sure the length of the auto-generated site permissions do not exceed the maximum length of the DB field.
Indeed. I simplified a the logic

if len(group_name) > max_len:
            tail = '~%s' % str(site.pk)
            group_name = group_name[:max_len - len(tail)] + tail

and this is both unique and fits the length. I see no need to include the role_id, since the role name is unique.

Sure, if len(group_name) == max_len, I am relaying on the uniqueness of the site domain and role name.