add some black
parent
d3c829fd7f
commit
ce20adb564
|
@ -5,12 +5,14 @@ from selfprivacy_api.graphql.mutations.mutation_interface import (
|
|||
)
|
||||
from enum import Enum
|
||||
|
||||
|
||||
@strawberry.enum
|
||||
class UserType(Enum):
|
||||
NORMAL = "NORMAL"
|
||||
PRIMARY = "PRIMARY"
|
||||
ROOT = "ROOT"
|
||||
|
||||
|
||||
@strawberry.type
|
||||
class User:
|
||||
"""Users management"""
|
||||
|
|
|
@ -108,7 +108,7 @@ class UserMutations:
|
|||
for key in data["ssh"]["rootKeys"]:
|
||||
if key == input.sshKey:
|
||||
data["ssh"]["rootKeys"].remove(key)
|
||||
|
||||
|
||||
return UserMutationReturn(
|
||||
success=True,
|
||||
message="SSH key deleted",
|
||||
|
|
|
@ -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 hash_password
|
||||
|
||||
|
||||
@strawberry.input
|
||||
class UserMutationsInput:
|
||||
"""Input type for user mutation"""
|
||||
|
@ -128,7 +129,6 @@ class UserMutations:
|
|||
"""Update user mutation"""
|
||||
hashed_password = hash_password(user.password)
|
||||
|
||||
|
||||
with WriteUserData() as data:
|
||||
ssh_keys = []
|
||||
if user.username == data["username"]:
|
||||
|
|
|
@ -38,7 +38,7 @@ class Users:
|
|||
for user in data["users"]:
|
||||
if user["username"] == username:
|
||||
user = User(data["username"], data["sshKeys"])
|
||||
|
||||
|
||||
return user
|
||||
|
||||
all_users: typing.List[User] = strawberry.field(resolver=get_users)
|
||||
|
|
|
@ -161,7 +161,6 @@ def get_dkim_key(domain):
|
|||
return None
|
||||
|
||||
|
||||
|
||||
def hash_password(password):
|
||||
hashing_command = ["mkpasswd", "-m", "sha-512", password]
|
||||
password_hash_process_descriptor = subprocess.Popen(
|
||||
|
|
Loading…
Reference in New Issue