add some black

pull/12/head
def 2022-07-22 12:36:11 +02:00
parent d3c829fd7f
commit ce20adb564
5 changed files with 5 additions and 4 deletions

View File

@ -5,12 +5,14 @@ from selfprivacy_api.graphql.mutations.mutation_interface import (
) )
from enum import Enum from enum import Enum
@strawberry.enum @strawberry.enum
class UserType(Enum): class UserType(Enum):
NORMAL = "NORMAL" NORMAL = "NORMAL"
PRIMARY = "PRIMARY" PRIMARY = "PRIMARY"
ROOT = "ROOT" ROOT = "ROOT"
@strawberry.type @strawberry.type
class User: class User:
"""Users management""" """Users management"""

View File

@ -108,7 +108,7 @@ class UserMutations:
for key in data["ssh"]["rootKeys"]: for key in data["ssh"]["rootKeys"]:
if key == input.sshKey: if key == input.sshKey:
data["ssh"]["rootKeys"].remove(key) data["ssh"]["rootKeys"].remove(key)
return UserMutationReturn( return UserMutationReturn(
success=True, success=True,
message="SSH key deleted", message="SSH key deleted",

View File

@ -13,6 +13,7 @@ from selfprivacy_api.graphql.mutations.mutation_interface import (
from selfprivacy_api.utils import WriteUserData, ReadUserData, is_username_forbidden from selfprivacy_api.utils import WriteUserData, ReadUserData, is_username_forbidden
from selfprivacy_api.utils import hash_password from selfprivacy_api.utils import hash_password
@strawberry.input @strawberry.input
class UserMutationsInput: class UserMutationsInput:
"""Input type for user mutation""" """Input type for user mutation"""
@ -128,7 +129,6 @@ class UserMutations:
"""Update user mutation""" """Update user mutation"""
hashed_password = hash_password(user.password) hashed_password = hash_password(user.password)
with WriteUserData() as data: with WriteUserData() as data:
ssh_keys = [] ssh_keys = []
if user.username == data["username"]: if user.username == data["username"]:

View File

@ -38,7 +38,7 @@ class Users:
for user in data["users"]: for user in data["users"]:
if user["username"] == username: if user["username"] == username:
user = User(data["username"], data["sshKeys"]) user = User(data["username"], data["sshKeys"])
return user return user
all_users: typing.List[User] = strawberry.field(resolver=get_users) all_users: typing.List[User] = strawberry.field(resolver=get_users)

View File

@ -161,7 +161,6 @@ def get_dkim_key(domain):
return None return None
def hash_password(password): def hash_password(password):
hashing_command = ["mkpasswd", "-m", "sha-512", password] hashing_command = ["mkpasswd", "-m", "sha-512", password]
password_hash_process_descriptor = subprocess.Popen( password_hash_process_descriptor = subprocess.Popen(