Skip to content

Commit

Permalink
Datasets (#1159)
Browse files Browse the repository at this point in the history
* DatasetPermission
  • Loading branch information
svetleo-evidently authored Jun 25, 2024
1 parent 51da531 commit 8561c3b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/evidently/pipeline/column_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TaskType:
RECOMMENDER_SYSTEMS: str = "recsys"


class RecomType(Enum):
class RecomType(str, Enum):
SCORE = "score"
RANK = "rank"

Expand Down
37 changes: 34 additions & 3 deletions src/evidently/ui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def additional_graphs(self):


class EntityType(Enum):
Dataset = "dataset"
Project = "project"
Team = "team"
Org = "org"
Expand Down Expand Up @@ -367,13 +368,18 @@ class Permission(Enum):
TEAM_WRITE = "team_write"
TEAM_CREATE_PROJECT = "team_create_project"
TEAM_DELETE = "team_delete"
TEAM_CREATE_DATASET = "team_create_dataset"

PROJECT_READ = "project_read"
PROJECT_WRITE = "project_write"
PROJECT_DELETE = "project_delete"
PROJECT_SNAPSHOT_ADD = "project_snapshot_add"
PROJECT_SNAPSHOT_DELETE = "project_snapshot_delete"

DATASET_READ = "datasets_read"
DATASET_WRITE = "datasets_write"
DATASET_DELETE = "datasets_delete"


class Role(BaseModel):
id: RoleID
Expand All @@ -399,25 +405,50 @@ class DefaultRole(Enum):
Permission.PROJECT_READ,
Permission.PROJECT_WRITE,
Permission.PROJECT_SNAPSHOT_ADD,
Permission.DATASET_READ,
Permission.TEAM_CREATE_DATASET,
Permission.DATASET_WRITE,
Permission.DATASET_DELETE,
},
(DefaultRole.EDITOR, EntityType.Team): {
Permission.TEAM_READ,
Permission.TEAM_WRITE,
Permission.TEAM_CREATE_PROJECT,
Permission.TEAM_CREATE_DATASET,
Permission.PROJECT_READ,
Permission.PROJECT_WRITE,
Permission.PROJECT_SNAPSHOT_ADD,
Permission.DATASET_READ,
Permission.DATASET_WRITE,
Permission.DATASET_DELETE,
},
(DefaultRole.EDITOR, EntityType.Project): {
Permission.PROJECT_READ,
Permission.PROJECT_WRITE,
Permission.PROJECT_SNAPSHOT_ADD,
},
(DefaultRole.VIEWER, EntityType.Org): {Permission.ORG_READ},
(DefaultRole.VIEWER, EntityType.Team): {Permission.TEAM_READ, Permission.PROJECT_READ},
(DefaultRole.VIEWER, EntityType.Project): {Permission.PROJECT_READ},
(DefaultRole.EDITOR, EntityType.Dataset): {
Permission.DATASET_READ,
Permission.DATASET_WRITE,
Permission.DATASET_DELETE,
},
(DefaultRole.VIEWER, EntityType.Org): {
Permission.ORG_READ,
},
(DefaultRole.VIEWER, EntityType.Team): {
Permission.TEAM_READ,
Permission.PROJECT_READ,
Permission.DATASET_READ,
},
(DefaultRole.VIEWER, EntityType.Project): {
Permission.PROJECT_READ,
},
(DefaultRole.VIEWER, EntityType.Dataset): {
Permission.DATASET_READ,
},
}


ENTITY_READ_PERMISSION = {
EntityType.Org: Permission.ORG_READ,
EntityType.Team: Permission.TEAM_READ,
Expand Down

0 comments on commit 8561c3b

Please sign in to comment.