[Koha-bugs] [Bug 29523] Add a way to prevent embedding objects that should not be allowed

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jan 14 08:33:08 CET 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29523

--- Comment #38 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
+sub accessible {
+    my ($self) = @_;
+
+    return $self->_get_objects_class->search_limited(
+        {
+            map { $_ => $self->$_ }
+              $self->_result->result_source->primary_columns
+        }
+      )->count > 0
+      ? 1
+      : 0;
+}

At first glance this looks like a great performance killer.
If we are in the singular object already, it should be very cheap to see if
user A has access.
Okay, we might have to duplicate a bit of code in accessible and search_limited
to make that work, but save performance. Which might be a more important gain.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list