Giter VIP home page Giter VIP logo

freeradius-api's People

Contributors

angely-dev avatar michaelarnauts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

freeradius-api's Issues

Allow updates to groups/users without removing/recreating them

Looking at the code (https://github.com/angely-dev/freeradius-api/blob/master/src/api.py#L9), the lack of support for updating entities is intentionally, and it's recommended to remove and re-create entities when an update is needed.

However, this is problematic for the use case where you want to update a group that already has users attached. I would like to update this group to add some more replies, but removing this isn't possible without removing the group (and links to the users). Also, since this isn't possible in one atomic operation, the users will be unlinked to a group for a brief moment.

I'm thinking on adding this functionality, but will be this be accepted in this project, or is this beyond the scope of this project?

Migrate to Pydantic v2

Pydantic recently released the v2 major version which breaks or deprecates some features of the v1. A migration guide has been published:

  • @root_validator is deprecated and should be replaced with @model_validator
  • The following config settings have been renamed: schema_extra โ†’ json_schema_extra

Add keyset pagination in the API

Some endpoints currently fetch and return all results without pagination. This could lead to performance issues.

In the era of infinite scrolling, the keyset pagination mechanism is generally preferred over the offset pagination mechanism. Work has started in 460de53 in that sense.

  • The REST API must now call the new find_usernames(), find_groupnames() and find_nasnames() methods in place of find_all_usernames(), find_all_groupnames() and find_all_nasnames() methods still there for legacy purposes.
  • The REST API must also tell the client how to navigate through pages. It can be implemented with either JSON metadata or the HTTP Link header as per RFC 5988 (this is what GitHub does actually).

Specify HTTP errors per endpoint

Some endpoints trigger HTTP errors (e.g., 404). Except for the 422 (internal RequestValidationError), HTTP errors are not yet specified per endpoint. FastAPI allows it through the additional-responses feature:

class Message(BaseModel):
    message: str

@app.get("/items/{item_id}", response_model=Item, responses={404: {"model": Message}})
async def read_item(item_id: str):
    if item_id == "foo":
        return {"id": "foo", "value": "there goes my hero"}
    return JSONResponse(status_code=404, content={"message": "Item not found"})

Iterate towards a "real" application that can be configured

First of all, I don't want to force this project into a direction you don't want to. Feel free to reject my comments and remarks :)

This project has a good functionality, but it's lacking options to configure it without having to edit the files. My goal is to have an application (probably packaged in a docker image) that can be configured and started with all database drivers included.

I'm looking at https://fastapi.tiangolo.com/advanced/settings/ to parse environment variables (and probably also command line variables now that pydantic/pydantic-settings#214 has been merged, a few days ago!), so the hardcoded configurations like the db_connection parameters, or the RadTables overrides can be removed and filled in from configuration.

I've started working on this, but if you don't like this direction, feel free to say so, and I'll setup a fork of this project with these changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.