It appears to pass all tests, but I’m not sure if my test writing skills are necessarily that great, I semi-followed the learn go with tests eBook. I appreciate any feedback, and if this isn’t an appropriate post for this community just let me know and I’ll remove.

Thanks!!

*** Update *** Updated the repository to be a bit more discriptive of what the library is for and added in a small example project of it in action.

  • tapdattl@lemmy.worldOP
    link
    fedilink
    arrow-up
    2
    ·
    1 day ago

    there’s no explanation of what this is supposed to do.

    Totally right, sorry about that, I’ll update the Github, but it brief this is a library that’s supposed to help a developer set up a Role Based Access Control system for an API for web service. Role Based Access Control is a method of access control whereby (And this is my very beginner’s understanding of it) users are assigned roles, and these roles are in turn issued different permissions based off what that role is supposed to have access to. When checking if a user is authorized access to a certain resource, the roles assigned to them are checked for the permissions needed for the resource. If they have permission then they are granted access to the resource, otherwise they are denied access.

    This library manages roles, permissions assigned to roles, and checking of permissions against roles via an http middleware.

    Then, there’s no main function. Where’s the entry point? This is a bit where I’m doubting myself now. Maybe go has changed, but when I was writing it, it requires a main function to even run.

    Well, this is supposed to be a library that’s used by other people, so it has no main function itself, rather it’s called by other people