Convert mixed-case group shortnames

Bug #1603302 reported by Ghada El-Zoghbi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Won't Fix
Medium
Unassigned

Bug Description

Mahara: master

With the new functionality added to allow admins to update the group shortname, an interesting paradigm now exists.

Currently, we allow mixed case alphanumeric characters for the shortname.

A variable was introduced 'retainshortname' to make sure the shortname entered (via the webservice and / or CSV upload ) is valid and follows the shortname naming conventions.

In the group_create() function (htdocs/lib/group.php), we then validate to make sure the shortname they've used (i.e. for newly created groups), matches what we would have generated automatically.

1. If the user specifies a mixed case shortname in the CSV upload, the generated shortname will not match as it always converts everything to lowercase.

2. If the user specifies a shortname completely unrelated to the display name, the shortname will also not match. i.e. shortname = 'abc' displayname = 'My Group'. The generated shortname will be 'mygroup'.

I'm of the opinion that the following needs to be modified:

1. The shortname should be alphanumeric lower case characters.

2. A common validation function needs to be created so the edit group, upload csv, and webservice group creation are using the same rules. Therefore, we won't have multiple validation functions for the same thing throughout the code.

3. We can eliminate the 'retainshortname' flag as we would have already validated the shortname if it got to the group_create() function.

4. An upgrade script to convert mixed case shortnames to lower case.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Ghada,

When setting up shortnames for groups for the CSV file, I tend to work with dashes / underscores so as to separate characters a bit better to make the shortname more readable. Could this be retained as we do also use dashes for clean URLs for example?

Cheers
Kristina

Changed in mahara:
status: New → Triaged
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Ghada and I discussed this a bit today, and we are splitting the issues she found up into to. This bug here concerns:

1. The shortname should be alphanumeric lower case characters.
4. An upgrade script to convert mixed case shortnames to lower case.

with the caveat that I think it would be good to also allow dashes and underscores as they can increase the readability of the shortnames and to my knowledge we could use them in the past.

The other two issues will be dealt with on bug #1607538.

summary: - Group Shortname Validatin
+ Convert mixed-case group shortnames
Changed in mahara:
milestone: none → 16.10.0
status: Triaged → Confirmed
importance: Undecided → Medium
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.0 → 16.10.1
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.1 → 17.04.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 17.04.0 → 17.10.0
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Note #1 is not an issue anymore. Dashes, underscores and dots can be used in short names.

Revision history for this message
Robert Lyon (robertl-9) wrote :

The upgrade in https://reviews.mahara.org/#/c/7128/5 will have made them all lowercase as group_generate_shortname() returns a lowercase value

Changed in mahara:
milestone: 17.10.0 → none
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.