Skip to content

Commit

Permalink
Private URL: clarify javadoc identfier todo #1012
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jun 22, 2016
1 parent 95570c7 commit 9480a63
Showing 1 changed file with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,31 @@ public class PrivateUrlUtil {
* to return a RoleAssignee (which can be either a User or a Group) when all
* you have is the string that is their identifier.
*
* @todo Consider using a new character, something other than ":" as a
* namespace for PrivateUrlUser rather than ":" which is for a short list of
* unchanging "predefinedRoleAssignees" which consists of
* :authenticated-users, :AllUsers, and :guest. A PrivateUrlUser is
* something of a different animal in that its identifier will vary based on
* the dataset that it is associated with. The number at the end of the
* identifier will vary.
* @todo Consider using a new character such as "#" (as suggested by
* Michael) as the unique namespace for PrivateUrlUser rather than ":" which
* means "builtin". Before the introduction of the Private URL feature, the
* prefix ":" was only used for a short list of unchanging
* "predefinedRoleAssignees" which consisted of the groups
* ":authenticated-users" and ":AllUsers" and the user ":guest". A
* PrivateUrlUser is something of a different animal in that its identifier
* will vary based on the dataset that it is associated with
* (":privateUrl42" for dataset 42, for example). The prefix we're using now
* is ":privateUrl". If we switch to "#" I guess we would just make it
* "#42"? Or would it be "#privateUrl42?" See also getRoleAssignee in
* RoleAssigneeServiceBean which is where the code would be cleaner if we
* use "#".
*
* @param identifier The identifier is expected to start with the
* PrivateUrlUser.PREFIX and end with a number for a dataset,
* ":privateUrl42", for example. The ":" indicates that this is a User
* rather than a Group (groups start with "&"). The number at the end of the
* identifier of a PrivateUrlUser is all we have to associate the role
* assignee identifier with a dataset. If we had the role assignment itself
* in our hands, we would simply get the dataset id from
* RoleAssignment.getDefinitionPoint and then use it to instantiate a
* PrivateUrlUser.
* ":privateUrl42", for example. The ":" indicates that this is a "builtin"
* role assignee. The number at the end of the identifier of a
* PrivateUrlUser is all we have to associate the role assignee identifier
* with a dataset. If we had the role assignment itself in our hands, we
* would simply get the dataset id from RoleAssignment.getDefinitionPoint
* and then use it to instantiate a PrivateUrlUser.
*
* @return A valid PrivateUrlUser (which like any User or Group is a
* RoleAssignee) if a valid identifer is provided or null.
* RoleAssignee) if a valid identifier is provided or null.
*/
public static RoleAssignee identifier2roleAssignee(String identifier) {
String[] parts = identifier.split(PrivateUrlUser.PREFIX);
Expand Down

0 comments on commit 9480a63

Please sign in to comment.