Author: jfthomps Date: Fri Mar 20 20:33:12 2009 New Revision: 756750 URL: http://svn.apache.org/viewvc?rev=756750&view=rev Log: VCL-115
modified checkForGroupName: renamed argument $resourcetypeid to $extraid and then also used it for the affiliationid of a user group in addition to ho w it was already being used so that user group uniqueness is determined by both name and affiliation modified processGroupInput: updated to checkForGroupName with resourcetypeid or affiliation as $extraid Modified: incubator/vcl/trunk/web/.ht-inc/groups.php Modified: incubator/vcl/trunk/web/.ht-inc/groups.php URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/groups.php?rev=756750&r1=756749&r2=756750&view=diff ============================================================================== --- incubator/vcl/trunk/web/.ht-inc/groups.php (original) +++ incubator/vcl/trunk/web/.ht-inc/groups.php Fri Mar 20 20:33:12 2009 @@ -599,10 +599,14 @@ . "and can only contain letters, numbers, and " . "these characters: - _ . :"; } + if($return['type'] == 'user') + $extraid = $return['affiliationid']; + else + $extraid = $return['resourcetypeid']; if(! empty($return["type"]) && ! empty($return["name"]) && ! ($submitErr & GRPNAMEERR) && checkForGroupName($return["name"], $return["type"], $return["groupid"], - $return["resourcetypeid"])) { + $extraid)) { $submitErr |= GRPNAMEERR; $submitErrMsg[GRPNAMEERR] = "A group already exists with this name."; } @@ -637,12 +641,13 @@ //////////////////////////////////////////////////////////////////////////////// /// -/// \fn checkForGroupName($name, $type, $id, $resourcetypeid) +/// \fn checkForGroupName($name, $type, $id, $extraid) /// /// \param $name - the name of a group /// \param $type - user or resource /// \param $id - id of a group to ignore -/// \param $resourcetypeid - a resource type +/// \param $extraid - if $type is resource, this is a resource type id; if +/// $type is user, this is an affiliation id /// /// \return 1 if $name is already in the associated table, 0 if not /// @@ -650,14 +655,15 @@ /// except for $id /// //////////////////////////////////////////////////////////////////////////////// -function checkForGroupName($name, $type, $id, $resourcetypeid) { +function checkForGroupName($name, $type, $id, $extraid) { if($type == "user") $query = "SELECT id FROM usergroup " - . "WHERE name = '$name'"; + . "WHERE name = '$name' AND " + . "affiliationid = $extraid"; else $query = "SELECT id FROM resourcegroup " . "WHERE name = '$name' AND " - . "resourcetypeid = $resourcetypeid"; + . "resourcetypeid = $extraid"; if(! empty($id)) $query .= " AND id != $id"; $qh = doQuery($query, 101);