Ejemplo n.º 1
0
    # ----------------------------------------------------------------------------------------------------------------
    # resources...

    # APIAuth...
    api_auth = APIAuth.load(Host)

    if api_auth is None:
        print("osio_client_auth: APIAuth not available.", file=sys.stderr)
        exit(1)

    if cmd.verbose:
        print("osio_client_auth: %s" % api_auth, file=sys.stderr)

    # User manager...
    user_manager = UserManager(HTTPClient(), api_auth.api_key)

    # Device manager...
    device_manager = DeviceManager(HTTPClient(), api_auth.api_key)

    # check for existing registration...
    device = device_manager.find_for_name(api_auth.org_id, Host.name())

    # check for existing ClientAuth...
    client_auth = ClientAuth.load(Host)


    # ----------------------------------------------------------------------------------------------------------------
    # remove non-matching record...

    if device and client_auth:
Ejemplo n.º 2
0
    if cmd.verbose:
        print("user: %s" % api_auth, file=sys.stderr)

    # ClientAuth...
    client_auth = ClientAuth.load(Host)

    if client_auth is None:
        print("user: ClientAuth not available.", file=sys.stderr)
        exit(1)

    if cmd.verbose:
        print("user: %s" % client_auth, file=sys.stderr)
        sys.stderr.flush()

    # manager...
    manager = UserManager(HTTPClient(), api_auth.api_key)

    # ----------------------------------------------------------------------------------------------------------------
    # run...

    # find self...
    user = manager.find(client_auth.user_id)

    if user is None:
        print("user: User not found.", file=sys.stderr)
        exit(1)

    if cmd.set():
        name = user.name if cmd.name is None else cmd.name
        email = user.email if cmd.email is None else cmd.email
        password = user.password if cmd.password is None else cmd.password
Ejemplo n.º 3
0
        exit(2)

    if cmd.verbose:
        print("public_user: %s" % cmd, file=sys.stderr)

    # ----------------------------------------------------------------------------------------------------------------
    # resources...

    # APIAuth...
    api_auth = APIAuth.load(Host)

    if api_auth is None:
        print("public_user: APIAuth not available.", file=sys.stderr)
        exit(1)

    if cmd.verbose:
        print("public_user: %s" % api_auth, file=sys.stderr)
        sys.stderr.flush()

    # manager...
    manager = UserManager(api_auth.api_key)

    # ----------------------------------------------------------------------------------------------------------------
    # run...

    # find self...
    user = manager.find_public(cmd.user_id)

    if user:
        print(JSONify.dumps(user))