List Info

Thread: Creating Users




Creating Users
user name
2006-03-07 19:59:04
Try it via the "P4::Run()" method. The Save<cmd> is a shortcut to the P4::Run() command anyway. It could be that it needs the "-f" flag (which you can't do via P4::Save&lt;Cmd>):
 
$p4->SetInput($spec);
$p4->Run("user", "-fi");

From: Scott Lavender [mailto:scott.lavendervisiprise.com]
Sent: Tuesday, March 07, 2006 2:46 PM
To: Weintraub, David; p4perlperforce.com
Subject: RE: [p4perl] Creating Users

Thanks for the help David. It works great. But, I have a follow up question. After modifying the user hash, what would be the corresponding way to save/create the user? I though it would be:
 
$p4->SaveUser( $user );
 
But, this does not seem to work.
 
Thanks.....Scott...
-----Original Message-----
From: Weintraub, David [mailto:david.weintraubbofasecurities.com]
Sent: Tuesday, March 07, 2006 2:00 PM
To: Scott Lavender; p4perlperforce.com
Subject: RE: [p4perl] Creating Users

You don't need the "-f" in the FetchUsers method. In fact, I'm not even sure it takes it. Try:
 
$user = $p4->FetchUser("testUser");
 
or
 
$user = $p4->Run("users", "-o", "testUser");
 
Which is the equivalent. If you need the "-f" parameter, you'll have to do this:
 
$user = $p4->Run("users", "-of", "testUser");
 
Fetch user will also return a new user too, so you can't use it to test to see if a user already exists. Use:
 
$userList = $p4->FetchUsers();
 
or
 
$userList = $p4->Run("users", "-o");
 
if the first method doesn't work. Then, you have to parse what was returned to see if the user actually exists. I'm not 100% sure what this will return. You'll have to play around with it a bit. If you also set P4->Tagged(), this should return a reference to an array of hashes.


From: p4perl-bouncesperforce.com [mailto:p4perl-bouncesperforce.com] On Behalf Of Scott Lavender
Sent: Tuesday, March 07, 2006 1:27 PM
To: p4perlperforce.com
Subject: [p4perl] Creating Users

I need to write a script to create users. But, I am having problems performing a fetch on the user command. First I thought of using this:
 

require P4;
my $p4 = new P4;
 
$p4->ParseForms();
$p4->Connect or die ( "Failed to connect to Perforce Server" );

my $fetched = $p4->FetchUser( "-f testUser" );
...

 
Nothing is returned by the call to FetchUser. I assume it has to do with the force option. Is there a way to do this when creating new users?
 
Thanks.....
 
Scott Lavender | SCM Specialist | Visiprise | office: 770.619.4166 | www.visiprise.com
 

It is our company policy not to accept email of any data controlled by the International Traffic in Arms Regulations (ITAR). Please contact our Security Officer,&nbsp;Matt Reeves, for instructions and authorization to transmit such data.

 
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )