diff --git a/spiffworkflow-backend/src/.coverage.jason-Gazelle.473795.719220 b/spiffworkflow-backend/src/.coverage.jason-Gazelle.473795.719220 new file mode 100644 index 00000000..3c5fc708 Binary files /dev/null and b/spiffworkflow-backend/src/.coverage.jason-Gazelle.473795.719220 differ diff --git a/spiffworkflow-backend/src/.coverage.jason-Gazelle.475245.497833 b/spiffworkflow-backend/src/.coverage.jason-Gazelle.475245.497833 new file mode 100644 index 00000000..214df28d Binary files /dev/null and b/spiffworkflow-backend/src/.coverage.jason-Gazelle.475245.497833 differ diff --git a/spiffworkflow-backend/src/.coverage.jason-Gazelle.476451.578823 b/spiffworkflow-backend/src/.coverage.jason-Gazelle.476451.578823 new file mode 100644 index 00000000..ef7f5c49 Binary files /dev/null and b/spiffworkflow-backend/src/.coverage.jason-Gazelle.476451.578823 differ diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/add_permission.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/add_permission.py deleted file mode 100644 index 113a92da..00000000 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/add_permission.py +++ /dev/null @@ -1,32 +0,0 @@ -"""Get_env.""" -from typing import Any - -from spiffworkflow_backend.models.script_attributes_context import ( - ScriptAttributesContext, -) -from spiffworkflow_backend.scripts.script import Script -from spiffworkflow_backend.services.authorization_service import AuthorizationService - -# add_permission("read", "test/*", "Editors") - - -class AddPermission(Script): - """AddUserToGroup.""" - - def get_description(self) -> str: - """Get_description.""" - return """Add a permission to a group. ex: add_permission("read", "test/*", "Editors") """ - - def run( - self, - script_attributes_context: ScriptAttributesContext, - *args: Any, - **kwargs: Any, - ) -> Any: - """Run.""" - allowed_permission = args[0] - uri = args[1] - group_identifier = args[2] - AuthorizationService.add_permission_from_uri_or_macro( - group_identifier=group_identifier, target=uri, permission=allowed_permission - ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/add_user_to_group.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/add_user_to_group.py deleted file mode 100644 index 814cf6dc..00000000 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/add_user_to_group.py +++ /dev/null @@ -1,35 +0,0 @@ -"""Get_env.""" -from typing import Any - -from spiffworkflow_backend.models.script_attributes_context import ( - ScriptAttributesContext, -) -from spiffworkflow_backend.models.user import UserModel -from spiffworkflow_backend.scripts.script import Script -from spiffworkflow_backend.services.group_service import GroupService -from spiffworkflow_backend.services.user_service import UserService - - -class AddUserToGroup(Script): - """AddUserToGroup.""" - - def get_description(self) -> str: - """Get_description.""" - return """Add a given user to a given group. Ex. add_user_to_group(group='Education', service_id='1234123')""" - - def run( - self, - script_attributes_context: ScriptAttributesContext, - *args: Any, - **kwargs: Any, - ) -> Any: - """Run.""" - username = args[0] - group_identifier = args[1] - - group = GroupService.find_or_create_group(group_identifier) - user = UserModel.query.filter_by(username=username).first() - if user: - UserService.add_user_to_group(user, group) - else: - UserService.add_waiting_group_assignment(username, group) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/clear_permissions.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/clear_permissions.py deleted file mode 100644 index bf81acfc..00000000 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/clear_permissions.py +++ /dev/null @@ -1,25 +0,0 @@ -"""Get_env.""" -from typing import Any - -from spiffworkflow_backend.models.script_attributes_context import ( - ScriptAttributesContext, -) -from spiffworkflow_backend.scripts.script import Script -from spiffworkflow_backend.services.authorization_service import AuthorizationService - - -class ClearPermissions(Script): - """Clear all permissions across the system .""" - - def get_description(self) -> str: - """Get_description.""" - return """Remove all groups and permissions from the database.""" - - def run( - self, - script_attributes_context: ScriptAttributesContext, - *args: Any, - **kwargs: Any, - ) -> Any: - """Run.""" - AuthorizationService.delete_all_permissions()