Forum Discussion
Steve_Brown_882
Mar 10, 2011Historic F5 Account
create_user_3 in a perl script
Hey Guys,
I don't do a lot of perl scripting so I am hoping for a little help getting a script to work. Basically I have pieced som code together from the forums but it doesn't quite work. ...
Mar 11, 2011
You've got a few too many brackets in your UserInfo structure. By putting brackets around all parameters you are turning them all into arrays. Also, for a boolean, you'll have to use either 0 or 1.
Give this a shot:
sub handle_create()
{
my ($UserName, $FullName, $Role, $Partition ) = @_;
if ( $UserName eq "" ) { $UserName = "testuser1"; }
if ( $FullName eq "" ) { $FullName = "New User"; }
if ( $Role eq "" ) { $Role = USER_ROLE_GUEST ; }
if ( $Partition eq "" ) { $Partition = "Common" ; }
$Password = {
is_encrypted => 0,
password => ""
};
$UserID = {
name => $UserName,
full_name => $FullName
};
$UserPermissions = {
role => $Role,
partition => $Partition
};
$UserInfo = {
user => $UserID,
password => $Password,
permisisions => [$UserPermissions],
login_shell => "",
};
$soapResponse = $UserManagement->create_user_3(
SOAP::Data->name(users => [$UserInfo])
);
};
Notice, I've removed the "login_shell" parameter as USER_ROLE_GUEST doesn't have the access to specify a custom shell.
-Joe
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects