Skip to content

Commit

Permalink
style: flake8 styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-pisman committed Oct 13, 2023
1 parent d4d7980 commit 44a7dce
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/unipoll_api/actions/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def create_group(workspace: Workspace,
# Add the account to group member list
await new_group.add_member(account, Permissions.GROUP_ALL_PERMISSIONS)

# Create a policy for the new group
# Create a policy for the new group
await workspace.add_policy(new_group, Permissions.GROUP_BASIC_PERMISSIONS, False)
workspace.groups.append(new_group) # type: ignore
await Workspace.save(workspace, link_rule=WriteRules.WRITE)
Expand All @@ -72,7 +72,7 @@ async def create_group(workspace: Workspace,


# Get group
async def get_group(group: Group,
async def get_group(group: Group,
include_members: bool = False,
include_policies: bool = False,
check_permissions: bool = True) -> GroupSchemas.Group:
Expand Down
5 changes: 3 additions & 2 deletions src/unipoll_api/actions/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ async def update_workspace(workspace: Workspace,
input_data: WorkspaceSchemas.WorkspaceUpdateRequest,
check_permissions: bool = True) -> WorkspaceSchemas.Workspace:
await Permissions.check_permissions(workspace, "update_workspace", check_permissions)

save_changes = False

# Check if user suplied a name
if input_data.name and input_data.name != workspace.name:
# Check if workspace name is unique
Expand All @@ -91,7 +91,8 @@ async def update_workspace(workspace: Workspace,
# Delete a workspace
async def delete_workspace(workspace: Workspace, check_permissions: bool = True):
await Permissions.check_permissions(workspace, "delete_workspace", check_permissions)


# Delete all groups in the workspace
for group in workspace.groups:
await actions.GroupActions.delete_group(group) # type: ignore

Expand Down
4 changes: 1 addition & 3 deletions src/unipoll_api/dependencies.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from typing import Annotated
from functools import wraps
from fastapi import Cookie, Depends, Query, Request, HTTPException, WebSocket
from fastapi import Cookie, Depends, Query, HTTPException, WebSocket
from unipoll_api.account_manager import active_user, get_current_active_user
from unipoll_api.documents import ResourceID, Workspace, Group, Account, Poll, Policy
from unipoll_api.utils import permissions as Permissions
from unipoll_api import exceptions as Exceptions
from unipoll_api.utils.path_operations import extract_action_from_path, extract_resourceID_from_path


# Wrapper to handle exceptions and raise HTTPException
Expand Down

0 comments on commit 44a7dce

Please sign in to comment.