[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2621] trunk
- Subject: SF.net SVN: ledger-smb:[2621] trunk
- From: ..hidden..
- Date: Thu, 04 Jun 2009 02:25:56 +0000
Revision: 2621
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2621&view=rev
Author: einhverfr
Date: 2009-06-04 02:25:56 +0000 (Thu, 04 Jun 2009)
Log Message:
-----------
User creation now somewhat works.
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Admin.pm
trunk/LedgerSMB/DBObject/User.pm
trunk/scripts/admin.pl
Modified: trunk/LedgerSMB/DBObject/Admin.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Admin.pm 2009-06-04 00:50:53 UTC (rev 2620)
+++ trunk/LedgerSMB/DBObject/Admin.pm 2009-06-04 02:25:56 UTC (rev 2621)
@@ -52,7 +52,6 @@
]
);
$user->get();
- $user->save();
$self->{user} = $user;
$self->{employee} = $employee;
$self->debug({file => '/tmp/user11'});
Modified: trunk/LedgerSMB/DBObject/User.pm
===================================================================
--- trunk/LedgerSMB/DBObject/User.pm 2009-06-04 00:50:53 UTC (rev 2620)
+++ trunk/LedgerSMB/DBObject/User.pm 2009-06-04 02:25:56 UTC (rev 2621)
@@ -105,30 +105,15 @@
my $user = $self->get();
- if ( $user->{id} && $self->{is_a_user} ) {
- # doesn't check for the password - that's done in the sproc.
- $self->{id} = shift @{ $self->exec_method(funcname=>'admin__save_user',
- args=>[$user->{id}, $self->{username}, $self->{password}] ) };
- if (!$self->{id}) {
-
- return 0;
- }
- }
- elsif ($user && !$self->{is_a_user}) {
+ # doesn't check for the password - that's done in the sproc.
+ my ($ref) = $self->exec_method(funcname=>'admin__save_user',
+ args=>[$user->{id}, $self->{username}, $self->{password}] );
+ ($self->{id}) = values %$ref;
+ if (!$self->{id}) {
- # there WAS a user, and we've decided we want that user to go away now.
-
- $self->{id} = $user->{id};
- return $self->remove();
-
+ return 0;
}
- elsif ($self->{is_a_user}) {
-
- # No user ID, meaning, creating a new one.
- $self->{id} = shift @{ $self->exec_method(funcname=>'admin__save_user',
- args=>[undef, $self->{username}, $self->{password}] ) };
- }
return 1;
}
@@ -142,14 +127,11 @@
my ($user) = $self->exec_method(
funcname=>'admin__get_user',
);
- print STDERR "Point 1\n";
$self->{user} = $user;
my ($prefs) = $self->exec_method(
funcname=>'user__get_preferences',
);
- print STDERR "Point 1\n";
$self->{prefs} = $prefs;
- print STDERR "Point 2\n";
# $self->{person} = @{ $self->exec_method(
# funcname=>'admin__user_preferences',
# args=>[$self->{user}->{entity_id}]
@@ -190,7 +172,6 @@
$self->{roles} = ..hidden..;
$self->{entity_id} = $self->{entity}->{id};
- print STDERR "Got all user information";
#$user->{user} = $u->get($id);
#$user->{pref} = $u->preferences($id);
@@ -198,6 +179,7 @@
#$user->{person} = $u->person($user->{user}->{entity_id});
#$user->{entity} = $u->entity($id);
#$user->{roles} = $u->roles($id);
+ return $user;
}
sub remove {
Modified: trunk/scripts/admin.pl
===================================================================
--- trunk/scripts/admin.pl 2009-06-04 00:50:53 UTC (rev 2620)
+++ trunk/scripts/admin.pl 2009-06-04 02:25:56 UTC (rev 2621)
@@ -82,7 +82,7 @@
$template->render(
{
- user=>$entity,
+ user=>$admin,
salutations=>$sal,
roles=>$groups
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.