Skip to content

Commit 1cc468d

Browse files
committed
Merge branch '5.0.5-releng' into 5.0-trunk
2 parents 7e3a1ba + 90fb016 commit 1cc468d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+28660
-21848
lines changed

docs/web_deployment.pod

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,31 @@ RT to access the Authorization header.
154154

155155
More information is available in L<RT::Authen::Token>.
156156

157+
=head3 Restricting the REST 1.0 mail-gateway
158+
159+
RT processes email via a REST 1.0 endpoint. If you accept email on the same
160+
server as your running RT, you can restrict this endpoint to localhost only
161+
with a configuration like the following:
162+
163+
# Accept requests only from localhost
164+
<Location /REST/1.0/NoAuth/mail-gateway>
165+
Require local
166+
</Location>
167+
168+
If you run C<bin/rt-mailgate> on a separate server, you can update
169+
the above to allow additional IP addresses.
170+
171+
<Location /REST/1.0/NoAuth/mail-gateway>
172+
Require ip 127.0.0.1 ::1 192.0.2.0 # Add your actual IPs
173+
</Location>
174+
175+
See the L<Apache documentation|https://httpd.apache.org/docs/2.4/mod/mod_authz_host.html>
176+
for additional configuration options.
177+
178+
After adding this configuration, test receiving email and confirm
179+
your C<bin/rt-mailgate> utility and C</etc/aliases> configurations
180+
can successfully submit email to RT.
181+
157182
=head2 nginx
158183

159184
C<nginx> requires that you start RT's fastcgi process externally, for

lib/RT/Articles.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,11 @@ sub SimpleSearch {
975975
return $self;
976976
}
977977

978+
sub CurrentUserCanSeeAll {
979+
my $self = shift;
980+
return $self->CurrentUser->HasRight( Right => 'ShowArticle', Object => RT->System ) ? 1 : 0;
981+
}
982+
978983
RT::Base->_ImportOverlays();
979984

980985
1;

lib/RT/Assets.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,11 @@ sub _ProcessRestrictions {
19321932

19331933
}
19341934

1935+
sub CurrentUserCanSeeAll {
1936+
my $self = shift;
1937+
return $self->CurrentUser->HasRight( Right => 'ShowAsset', Object => RT->System ) ? 1 : 0;
1938+
}
1939+
19351940
1;
19361941

19371942
RT::Base->_ImportOverlays();

lib/RT/Attachment.pm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,17 @@ sub _CacheConfig {
10921092
}
10931093

10941094

1095+
=head2 CurrentUserCanSee
1096+
1097+
Returns true if the current user can see the attachment, via corresponding
1098+
transaction's rights check.
1099+
1100+
=cut
1101+
1102+
sub CurrentUserCanSee {
1103+
my $self = shift;
1104+
return $self->TransactionObj->CurrentUserCanSee;
1105+
}
10951106

10961107

10971108
=head2 id

lib/RT/Catalog.pm

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,28 @@ sub CurrentUserCanSee {
297297
|| $self->CurrentUserHasRight('AdminCatalog');
298298
}
299299

300+
=head2 CurrentUserCanCreate
301+
302+
Returns true if the current user can create a new catalog, using I<AdminCatalog>.
303+
304+
=cut
305+
306+
sub CurrentUserCanCreate {
307+
my $self = shift;
308+
return $self->CurrentUserHasRight('AdminCatalog');
309+
}
310+
311+
=head2 CurrentUserCanModify
312+
313+
Returns true if the current user can modify the catalog, using I<AdminCatalog>.
314+
315+
=cut
316+
317+
sub CurrentUserCanModify {
318+
my $self = shift;
319+
return $self->CurrentUserHasRight('AdminCatalog');
320+
}
321+
300322
=head2 Owner
301323
302324
Returns an L<RT::User> object for this catalog's I<Owner> role group. On error,

lib/RT/Catalogs.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ sub _Init {
114114

115115
sub Table { "Catalogs" }
116116

117+
sub CurrentUserCanSeeAll {
118+
my $self = shift;
119+
return $self->CurrentUser->HasRight( Right => 'ShowCatalog', Object => RT->System ) ? 1 : 0;
120+
}
121+
117122
RT::Base->_ImportOverlays();
118123

119124
1;

lib/RT/Class.pm

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,39 @@ sub IncludeArticleCFValue {
507507
return $self->{'_cf_include_hash'}{"Value-".$cfobj->Id};
508508
}
509509

510+
=head2 CurrentUserCanSee
511+
512+
Returns true if the current user can see the class, using I<SeeClass>.
513+
514+
=cut
515+
516+
sub CurrentUserCanSee {
517+
my $self = shift;
518+
return $self->CurrentUserHasRight('SeeClass');
519+
}
520+
521+
=head2 CurrentUserCanCreate
522+
523+
Returns true if the current user can create a new class, using I<AdminClass>.
524+
525+
=cut
526+
527+
sub CurrentUserCanCreate {
528+
my $self = shift;
529+
return $self->CurrentUserHasRight('AdminClass');
530+
}
531+
532+
=head2 CurrentUserCanModify
533+
534+
Returns true if the current user can modify the class, using I<AdminClass>.
535+
536+
=cut
537+
538+
sub CurrentUserCanModify {
539+
my $self = shift;
540+
return $self->CurrentUserHasRight('AdminClass');
541+
}
542+
510543
=head2 id
511544
512545
Returns the current value of id.

lib/RT/Classes.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ sub AddRecord {
8181

8282
sub _SingularClass { "RT::Class" }
8383

84+
sub CurrentUserCanSeeAll {
85+
my $self = shift;
86+
return $self->CurrentUser->HasRight( Right => 'SeeClass', Object => RT->System ) ? 1 : 0;
87+
}
88+
8489
RT::Base->_ImportOverlays();
8590

8691
1;

lib/RT/CustomField.pm

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,28 @@ sub CurrentUserCanSee {
20722072
return 0;
20732073
}
20742074

2075+
=head2 CurrentUserCanCreate
2076+
2077+
If the user has I<AdminCustomField> they can create a new custom field.
2078+
2079+
=cut
2080+
2081+
sub CurrentUserCanCreate {
2082+
my $self = shift;
2083+
return $self->CurrentUserHasRight('AdminCustomField');
2084+
}
2085+
2086+
=head2 CurrentUserCanModify
2087+
2088+
If the user has I<AdminCustomField> they can modify the custom field.
2089+
2090+
=cut
2091+
2092+
sub CurrentUserCanModify {
2093+
my $self = shift;
2094+
return $self->CurrentUserHasRight('AdminCustomField');
2095+
}
2096+
20752097
=head2 IncludeContentForValue [VALUE] (and SetIncludeContentForValue)
20762098
20772099
Gets or sets the C<IncludeContentForValue> for this custom field. RT

lib/RT/CustomFields.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,11 @@ sub LimitToCatalog {
475475
}
476476
}
477477

478+
sub CurrentUserCanSeeAll {
479+
my $self = shift;
480+
return $self->CurrentUser->HasRight( Right => 'SeeCustomField', Object => RT->System ) ? 1 : 0;
481+
}
482+
478483
RT::Base->_ImportOverlays();
479484

480485
1;

0 commit comments

Comments
 (0)