[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. c1e20a06489799c4bb0bad113fd77e061f1da390

Stefan Hornburg racke at rt.icdevgroup.org
Tue Jun 9 15:39:05 UTC 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Interchange wellwell catalog".

The branch, master has been updated
       via  c1e20a06489799c4bb0bad113fd77e061f1da390 (commit)
      from  dd29dd807639e10fe71571367d3f2a8a0e65e785 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c1e20a06489799c4bb0bad113fd77e061f1da390
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Tue Jun 9 17:38:55 2009 +0200

    [user]: added function exists

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

Summary of changes and diff:
 code/user.tag |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/code/user.tag b/code/user.tag
index 9b8f056..2c5b8f6 100644
--- a/code/user.tag
+++ b/code/user.tag
@@ -1,4 +1,5 @@
 UserTag user Order function uid
+UserTag user AddAttr
 UserTag user Documentation <<EOD
 
 =head1 NAME
@@ -35,6 +36,10 @@ User ID. Default to current logged in user.
 
 [user name 23223]
 
+=item Determine whether user racke exists
+
+[user function=exists username=racke]
+
 =head2
 
 =back
@@ -51,15 +56,44 @@ EOD
 
 UserTag user Routine <<EOR
 sub {
-	my ($function, $uid) = @_;
+	my ($function, $uid, $opt) = @_;
 	my ($uref);
 
+	$Tag->perl({tables => 'users'});
+
+	if ($function eq 'exists') {
+		my ($field, $val, $set);
+
+		# lookup username
+		if ($opt->{username}) {
+			$field = 'username';
+			$val = $opt->{username};
+		}
+		elsif ($opt->{email}) {
+			$field = 'email';
+			$val = $opt->{email};
+		}
+		elsif ($uid) {
+			$field = 'uid';
+			$val = $uid;
+		}
+		else {
+			return;
+		}
+
+		$set = $Db{users}->query(qq{select uid from users where $field = '%s'}, $val);
+
+		if (@$set) {
+			return $set->[0]->[0];
+		}
+
+		return;
+	}
+
 	unless ($uid){
 		$uid = $Session->{username};
 	}
 
-	$Tag->perl({tables => 'users'});
-
 	# fetch user record
 	unless ($uref = $Db{users}->row_hash($uid)) {
 		$uref = {username => 'anonymous'};


hooks/post-receive
-- 
Interchange wellwell catalog



More information about the wellwell-devel mailing list