5 use RT::Test tests => 12;
7 my $q = RT::Queue->new($RT::SystemUser);
8 my ($id,$msg) =$q->Create(Name => "CF-Rights-".$$);
11 my $cf = RT::CustomField->new($RT::SystemUser);
12 ($id,$msg) = $cf->Create(Name => 'CF-'.$$, Type => 'Select', MaxValues => '1', Queue => $q->id);
16 ($id,$msg) =$cf->AddValue(Name => 'First');
19 my $u = RT::User->new($RT::SystemUser);
20 ($id,$msg) = $u->Create( Name => 'User1', Privileged => 1 );
23 ($id,$msg) = $u->PrincipalObj->GrantRight( Object => $cf, Right => 'SeeCustomField' );
26 my $ucf = RT::CustomField->new($u);
27 ($id,$msg) = $ucf->Load( $cf->Id );
30 my $cfv = $ucf->Values->First;
32 ($id,$msg) = $cfv->SetName( 'First1' );
35 ($id,$msg) = $u->PrincipalObj->GrantRight( Object => $cf, Right => 'AdminCustomFieldValues' );
38 ($id,$msg) = $cfv->SetName( 'First2' );
41 ($id,$msg) = $u->PrincipalObj->RevokeRight( Object => $cf, Right => 'AdminCustomFieldValues' );
44 ($id,$msg) = $u->PrincipalObj->GrantRight( Object => $cf, Right => 'AdminCustomField' );
47 ($id,$msg) = $cfv->SetName( 'First3' );