pycroft icon indicating copy to clipboard operation
pycroft copied to clipboard

Add support for MPSK

Open mabezi opened this issue 1 year ago • 2 comments

In order for MPSK to be used by our members, an appropriate frontend, including an API endpoint, must be implemented.

The following SQL schema is currently planned:

CREATE TABLE wifi_mpsk_clients(
    owner_id INT NOT NULL,
    name character varying,
    mac macaddr NOT NULL,
    UNIQUE(mac),
    CONSTRAINT fk_owner_id FOREIGN KEY (owner_id) REFERENCES pycroft."user"(id) ON DELETE CASCADE
);

A MAC address must be uniquely assignable to a user. However, a user can create as many MAC addresses as they wish.

To better distinguish between devices, it is planned to allow users to assign names to their devices.

The frontend can thus be implemented similarly to the existing interface list. This can then be placed in a separate tab, "WiFi" or similar, on the user page.

To simplify troubleshooting in case of issues, a note should be added in the frontend if the user has a legacy WiFi password that is not stored in plain text. (Reminder: WiFi password ≠ login password)

Feel free to ask questions if necessary.

mabezi avatar Aug 10 '24 06:08 mabezi

The frontend can thus be implemented similarly to the existing interface list.

To give a few pointers to anyone willing to work on this:

  1. These are the interface views

https://github.com/agdsn/pycroft/blob/865ebcf6bfc5a7a3b02966bf64e00c2342b42717/web/blueprints/host/init.py#L209-L327

  1. these are the underlying lib functions containing the core CRUD (Create, Read, Update, Delete) logic.

https://github.com/agdsn/pycroft/blob/865ebcf6bfc5a7a3b02966bf64e00c2342b42717/pycroft/lib/host.py#L110-L221

lukasjuhrich avatar Aug 12 '24 11:08 lukasjuhrich

A straightforward way to implement this feature in the UI would be to place a second table, named "mpsk clients", below the hosts table: image

lukasjuhrich avatar Aug 14 '24 14:08 lukasjuhrich

I would add a not null for the name so its better identifiable

I currently also added another tab instate of putting it below the old one, first it looks way cleaner at the fronted side and in code as well as it is better structured

agmes4 avatar Sep 15 '24 20:09 agmes4

First of all thank you @agmes4 :)

I see that you use „WLAN“ in your implementation at the moment. In order to maintain uniformity, it may be better to use „WiFi“. (Except in the German translation, since „WLAN“ is more common in Germany.)

mabezi avatar Sep 15 '24 22:09 mabezi

Your totally right will change this thanks :)

agmes4 avatar Sep 16 '24 06:09 agmes4

@agmes4 feel free to create a draft PR to allow for reviews :)

lukasjuhrich avatar Sep 17 '24 12:09 lukasjuhrich