[rt-users] import data/emails

Ruslan Zakirov ruz at bestpractical.com
Fri Oct 21 07:42:27 EDT 2011


Hi,

Always Cc rt-users@ lists.

On Thu, Oct 20, 2011 at 5:48 AM, Simon Walter <simon at gikaku.com> wrote:
> On Wednesday, October 19, 2011 05:52:51 PM you wrote:
>> my $user = RT::User->new( RT->SystemUser );
>> my ($status, $msg) = $user->Create( Name => $email, EmailAddress => $email
>> ); RT->Logger->error("Couldn't create user: $msg") unless $status;
>
>
> Nice. I just want to confirm this will create a user with no permissions. Is
> that correct?

Privileged and Disabled arguments control that. By default user is not
disabled, but is not privileged as well.

> Would this make a user the same as one that get created when an email is
> received?

Pretty much. $AutoCreate option controls defaults for email submissions.

> my $user = RT::User->new(RT->Nobody);

Using RT->Nobody is not correct.

> It would be useful to also put that user in a certain group.
>
> Does this make sense?
>
> my $group = RT::Group->new();
> $group->LoadUserDefinedGroup("Customers");
> $group->AddMember($user->id);

Good, except constructor's argument.

> I don't see any info on what to pass to the RT::Group constructor other than:
> RT::Group->new($CurrentUser);
>
> But is that meant to load the current user's group? What about:
> RT::Group->new(RT->Nobody);
> Or
> RT::Group->new(RT->SystemUser);


RT->SystemUser is ok. Nobody and SystemUser are special RT users.
Nobody has no rights except OwnTicket so he can be owner of any
ticket. SystemUser on the other hand has SuperUser right and can do
anything. So my $group = RT::Group->new( RT->SystemUser ); is one way
to go.

However, when you already have objects around then it's better to get
current users off them:

RT::Group->new( $other_object->CurrentUser )

-- 
Best regards, Ruslan.



More information about the rt-users mailing list