Skip to content

Fix RBAC for subpages in response models #3031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/zenml/zen_server/rbac/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,12 @@ def get_subresources_for_model(
# We previously used `dict(model)` here, but that lead to issues with
# models overwriting `__getattr__`, this `model.__iter__()` has the same
# results though.
for _, value in model.__iter__():
resources.update(_get_subresources_for_value(value))
if isinstance(model, Page):
for item in model:
resources.update(_get_subresources_for_value(item))
else:
for _, value in model.__iter__():
resources.update(_get_subresources_for_value(value))

return resources

Expand Down
5 changes: 3 additions & 2 deletions tests/integration/examples/discord/steps/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
# permissions and limitations under the License.

from typing import Tuple
from typing_extensions import Annotated

import numpy as np
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from typing_extensions import Annotated

from zenml import step

Expand All @@ -27,7 +28,7 @@ def digits_data_loader() -> (
Annotated[np.ndarray, "X_train"],
Annotated[np.ndarray, "X_test"],
Annotated[np.ndarray, "y_train"],
Annotated[np.ndarray, "y_test"]
Annotated[np.ndarray, "y_test"],
]
):
"""Loads the digits dataset as a tuple of flattened numpy arrays."""
Expand Down
Loading