[Rt-commit] rt branch, 4.4/role-lifecycle-right-check, repushed
Craig Kaiser
craig at bestpractical.com
Fri Aug 10 16:07:16 EDT 2018
The branch 4.4/role-lifecycle-right-check was deleted and repushed:
was eef8ba8fdc03fa96c61f568998b0a7b971f6ea5d
now 98a35896167271bee692721c30e1376dff3f578f
1: 6ed6267a0 ! 1: eee86e6cc Test lifecycle rights check at context object level
@@ -55,19 +55,19 @@
+
+ is $asset->CatalogObj->Lifecycle, 'assets', "System user can load asset without context object";
+
-+ my $group = $asset->RoleGroup('Owner');
-+ ok $group->id, "Loaded role group Owner for " . ref($asset);
-+
+ $asset = RT::Asset->new($user_a);
+ $asset->Load($id);
+ ok $asset->id, 'Loaded asset in user_a context';
+
+ is $asset->CatalogObj->Lifecycle, undef, "user_a can\'t see lifecycle without ShowCatalog and AdminCatalog";
+
-+ ($ret, $msg) = $group->AddMember($user_a->PrincipalId);
++ ($ret, $msg) = $asset->AddRoleMember(Type => 'Owner', User => $user_a);
+ ok $ret, $msg;
+
+ is $asset->CatalogObj->Lifecycle, 'assets', 'Successfully loaded lifecycle with rights check at role level';
++
++ my $lifecycle = $asset->CatalogObj->LifecycleObj;
++ is $lifecycle->Name, 'assets', 'Test LifecycleObj method';
+}
+
done_testing;
2: 212e0824e ! 2: e4071599e Add method for lifecycle rights check
@@ -106,8 +106,11 @@
}
- my $name = $self->Lifecycle || $fallback;
-+ my $name = $self->Lifecycle($context_obj) || $fallback;
-+ RT::Logger->debug('Failing back to default lifecycle value') unless $self->Lifecycle($context_obj);
++ my $name = $self->Lifecycle($context_obj);
++ if ( !$name ) {
++ RT::Logger->debug('Failing back to default lifecycle value');
++ $name = $fallback;
++ }
my $res = RT::Lifecycle->Load( Name => $name, Type => $type );
unless ( $res ) {
RT->Logger->error(
3: eef8ba8fd ! 3: 53d766b5b Test lifecycle rights by passing context object
@@ -20,17 +20,18 @@
is $asset->CatalogObj->Lifecycle, undef, "user_a can\'t see lifecycle without ShowCatalog and AdminCatalog";
+ is $asset->CatalogObj->Lifecycle($asset), undef, "user_a can\'t see lifecycle without ShowCatalog and AdminCatalog";
- ($ret, $msg) = $group->AddMember($user_a->PrincipalId);
+ ($ret, $msg) = $asset->AddRoleMember(Type => 'Owner', User => $user_a);
ok $ret, $msg;
- is $asset->CatalogObj->Lifecycle, 'assets', 'Successfully loaded lifecycle with rights check at role level';
+ is $asset->CatalogObj->Lifecycle($asset), 'assets', 'Successfully loaded lifecycle with rights check at role level';
+
+ my $lifecycle = $asset->CatalogObj->LifecycleObj;
+ is $lifecycle->Name, 'assets', 'Test LifecycleObj method';
+
-+ my $lifecycle = $asset->CatalogObj->LifecycleObj($asset);
-+ is $lifecycle->Name, 'assets', 'Test LifecycleObj method';
-+
-+ $lifecycle = $asset->CatalogObj->LifecycleObj;
++ $lifecycle = $asset->CatalogObj->LifecycleObj($asset);
+ is $lifecycle->Name, 'assets', 'Test LifecycleObj method';
}
done_testing;
+
-: ------- > 4: 98a358961 Test web UI for ticket status when rights granted at role level
More information about the rt-commit
mailing list