Skip to content
Snippets Groups Projects
Commit 8fa72f8d authored by florian's avatar florian
Browse files

ENH: Allow Athenticator to be managed by Julia or C

parent e527a0c3
No related branches found
No related tags found
1 merge request!4ENH: Add minimal functionality
Pipeline #10685 passed with warnings
Pipeline: CaosDB Julia Integration Tests

#10687

    ...@@ -81,13 +81,13 @@ authenticator object from a configuration. ...@@ -81,13 +81,13 @@ authenticator object from a configuration.
    mutable struct _Authenticator mutable struct _Authenticator
    wrapped_authenticator::Ptr{Cvoid} wrapped_authenticator::Ptr{Cvoid}
    function _Authenticator() function _Authenticator(managed_by_julia::Bool=false)
    auth = new() auth = new()
    # force this to point to C_NULL after initialization if managed_by_julia
    auth.wrapped_authenticator = C_NULL # Only append a finalizer for this if the object is
    # actually managed by Julia and not created and destroyed
    # internally by libcaosdb.
    function f(t) function f(t)
    if t.wrapped_authenticator != C_NULL
    # Only if pointer was filled after real initialization
    ccall( ccall(
    (:caosdb_authentication_delete_authenticator, "libccaosdb"), (:caosdb_authentication_delete_authenticator, "libccaosdb"),
    Cint, Cint,
    ...@@ -95,9 +95,10 @@ mutable struct _Authenticator ...@@ -95,9 +95,10 @@ mutable struct _Authenticator
    Ref{_Authenticator}(t), Ref{_Authenticator}(t),
    ) )
    end end
    end
    finalizer(f, auth) finalizer(f, auth)
    end end
    return auth
    end
    end end
    """ """
    ...@@ -115,7 +116,7 @@ function create_plain_password_authenticator( ...@@ -115,7 +116,7 @@ function create_plain_password_authenticator(
    password::AbstractString, password::AbstractString,
    ) )
    auth = Ref{_Authenticator}(_Authenticator()) auth = Ref{_Authenticator}(_Authenticator(true))
    err_code = ccall( err_code = ccall(
    (:caosdb_authentication_create_plain_password_authenticator, "libccaosdb"), (:caosdb_authentication_create_plain_password_authenticator, "libccaosdb"),
    ......
    ...@@ -96,6 +96,9 @@ mutable struct _Configuration ...@@ -96,6 +96,9 @@ mutable struct _Configuration
    function _Configuration(managed_by_julia::Bool=false) function _Configuration(managed_by_julia::Bool=false)
    config = new() config = new()
    if managed_by_julia if managed_by_julia
    # Only append a finalizer for this if the object is
    # actually managed by Julia and not created and destroyed
    # internally by libcaosdb.
    function f(t) function f(t)
    ccall( ccall(
    (:caosdb_connection_delete_connection_configuration, "libccaosdb"), (:caosdb_connection_delete_connection_configuration, "libccaosdb"),
    ...@@ -274,7 +277,7 @@ to. ...@@ -274,7 +277,7 @@ to.
    """ """
    function get_version_info(con::Ref{_Connection}) function get_version_info(con::Ref{_Connection})
    info = Ref{CaosDB.Info._VersionInfo}(CaosDB.Info._VersionInfo(true)) info = Ref{CaosDB.Info._VersionInfo}(CaosDB.Info._VersionInfo())
    err_code = ccall( err_code = ccall(
    (:caosdb_connection_get_version_info, "libccaosdb"), (:caosdb_connection_get_version_info, "libccaosdb"),
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment