예제 #1
0
    def remove(cls, user: User, scope: str, name: str):
        permission = cls.get(scope=scope, name=name)
        if permission in user.permissions:
            index = user.permissions.index(permission)
            user.permissions.pop(index)

        user.save()
예제 #2
0
    def signup(cls, username: str, email: str, password: str) -> User:
        user = User(email=email,
                    username=username,
                    password=auth.hashpwd(password))

        user.save()
        return user
예제 #3
0
파일: users.py 프로젝트: obasys/hikka
    def update_avatar(cls, user: User, file: File):
        if user.avatar is not None:
            FileService.destroy(user.avatar)

        user.avatar = file
        user.save()

        return user
예제 #4
0
파일: users.py 프로젝트: obasys/hikka
 def update(cls, user: User, **kwargs):
     user = update_document(user, kwargs)
     user.save()
예제 #5
0
    def add(cls, user: User, scope: str, name: str):
        permission = cls.get(scope=scope, name=name)
        if permission not in user.permissions:
            user.permissions.append(permission)

        user.save()