[drupal-devel] [feature] Unique roles feature patch

Uwe Hermann drupal-devel at drupal.org
Mon Sep 19 02:01:19 UTC 2005


Issue status update for 
http://drupal.org/node/27958
Post a follow up: 
http://drupal.org/project/comments/add/27958

 Project:      Drupal
 Version:      cvs
 Component:    user.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  kubaZygmunt
 Updated by:   Uwe Hermann
-Status:       patch (code needs review)
+Status:       patch (ready to be committed)

+1. Patch applies and works as expected.




Uwe Hermann



Previous comments:
------------------------------------------------------------------------

Mon, 01 Aug 2005 16:01:56 +0000 : kubaZygmunt

Attachment: http://drupal.org/files/issues/unique.roles.patch.txt (1.61 KB)

I've added code which prevents user from submiting 2 roles with the same
name.




------------------------------------------------------------------------

Tue, 02 Aug 2005 14:24:40 +0000 : breyten

+1 on feature (I think it's always useful to have these kind of checks
-- will probably save us bug reports in the future;), but -1 on the
patch. It's not necessary to call db_fetch_object to just get a role
id. You can change it to this:
$rid = db_result(db_query("SELECT rid FROM {role} WHERE name = '%s'",
$edit['name']);
and then simply
if ($rid) {
.
.
.




------------------------------------------------------------------------

Wed, 03 Aug 2005 10:34:01 +0000 : kubaZygmunt

Attachment: http://drupal.org/files/issues/unique.roles.patch_0.txt (1.57 KB)

Ok, I've changed code. I hope that this code will be good enough. ;)







More information about the drupal-devel mailing list