Skip to main content
. 2025 Mar 17;25(6):1857. doi: 10.3390/s25061857
Algorithm 3 loginUser and AccessData Function
  • Input: 

    userID, dataOwner, dataType

  • Output: 

    false, Data

  • 1:

    Retrieves user information from UserManagement using userID

  • 2:

    if user exists then

  • 3:

       Update userSessions with isLoggedIn, role, and department

  • 4:

       Check access permissions from PC

  • 5:

       if access is granted then

  • 6:

         return result from accessDataByOwner(dataOwner, dataType)

  • 7:

       else

  • 8:

         emit LogAccessDenied(msg.sender, “Access denied for the requested data type.”)

  • 9:

         return false

  • 10:

       end if

  • 11:

    else

  • 12:

       Emit LogAccessDenied event with the reason of “User does not exist.”

  • 13:

       return false

  • 14:

    end if