removed scripts for permissions since that code has been mostly moved and superseded by refresh_permissions w/ burnettk

This commit is contained in:
jasquat 2022-12-22 16:19:21 -05:00
parent 99e8dccd6e
commit c7590fa440
6 changed files with 0 additions and 92 deletions

View File

@ -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
)

View File

@ -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)

View File

@ -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()