Exemplo n.º 1
0
def remove_user(username, registered_user):
    if username is not None and registered_user is not None:
        if SystemManagers.is_system_manager(username) is not False:
            sys_manager = SystemManagers.is_system_manager(
                registered_user.username)
            is_store_manager = StoreManagers.is_store_manager(
                registered_user.username)
            is_owner = Owners.is_owner(registered_user.username)
            if sys_manager is False:
                user = RegisteredUsers.get_user(registered_user.username)
                if user is not False:
                    result_delete = True
                    if is_store_manager is not False:
                        result_delete = StoreManagers.remove_manager(
                            registered_user.username)
                    else:
                        if is_owner is not False:
                            result_delete = Owners.remove_owner(
                                registered_user.username)
                    final_result = result_delete and RegisteredUsers.remove_user(
                        registered_user.username)
                    if final_result:
                        LoggerLogic.add_event_log(username, "DELETE USER")
                    return final_result
            return False
    return False
Exemplo n.º 2
0
def remove_item_from_shop(item_id, username):
    if item_id is not None:
        item = Items.get_item(item_id)
        if item is not False:
            manager = StoreManagers.get_store_manager(username, item.shop_name)
            if manager is not False:
                remove_item_permission = manager.permission_remove_item
                if remove_item_permission > 0:
                    return Items.remove_item_from_shop(item_id)
            elif Owners.is_owner(username):
                return Items.remove_item_from_shop(item_id)

    return False