[Rt-commit] rt branch, 3.9-double_acl_cache, updated. rt-3.9.6-142-g789f7b1
Ruslan Zakirov
ruz at bestpractical.com
Mon Nov 29 16:40:14 EST 2010
The branch, 3.9-double_acl_cache has been updated
via 789f7b1099d1b6f3509de4aa92161786184ba3fa (commit)
from 0666190c8adac5db278ff4a103d843b586c90892 (commit)
Summary of changes:
lib/RT/Principal_Overlay.pm | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit 789f7b1099d1b6f3509de4aa92161786184ba3fa
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Nov 30 00:38:26 2010 +0300
document HasRights and cleanup HasRight's docs
* drop lies in HasRight's doc
* cross-reference methods
* describe cache pre-fill with HasRights before many HasRight calls
diff --git a/lib/RT/Principal_Overlay.pm b/lib/RT/Principal_Overlay.pm
index bd07048..e6fc204 100755
--- a/lib/RT/Principal_Overlay.pm
+++ b/lib/RT/Principal_Overlay.pm
@@ -218,29 +218,27 @@ sub RevokeRight {
-=head2 sub HasRight (Right => 'right' Object => undef)
-
+=head2 HasRight (Right => 'right' Object => undef)
Checks to see whether this principal has the right "Right" for the Object
-specified. If the Object parameter is omitted, checks to see whether the
-user has the right globally.
-
-This still hard codes to check to see if a user has queue-level rights
-if we ask about a specific ticket.
+specified. This takes the params:
+=over 4
-This takes the params:
+=item Right
- Right => name of a right
+name of a right
- And either:
+=item Object
- Object => an RT style object (->id will get its id)
+an RT style object (->id will get its id)
+=back
-Returns 1 if a matching ACE was found.
+Returns 1 if a matching ACE was found. Returns undef if no ACE was found.
-Returns undef if no ACE was found.
+Use L</HasRights> to fill a fast cache, especially if you're going to
+check many different rights with the same principal and object.
=cut
@@ -331,6 +329,17 @@ sub HasRight {
return ($hitcount);
}
+=head2 HasRights
+
+Returns a hash reference with all rights this principal has on an
+object. Takes Object as a named argument.
+
+Results are cached and re-used until L</InvalidateACLCache> called.
+Caching makes L</HasRight> calls for this principal and the same
+object much faster as well.
+
+=cut
+
sub HasRights {
my $self = shift;
my %args = (
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list