Skip to content

Commit bd3cf16

Browse files
committed
Add 'access' service to manage user access permissions.
1 parent 8e478ed commit bd3cf16

10 files changed

Lines changed: 682 additions & 156 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
syntax = "proto3";
2+
3+
package pirogue.admin.access;
4+
5+
import "google/protobuf/empty.proto";
6+
import "google/protobuf/wrappers.proto";
7+
8+
/*
9+
Manage accesses to this PiRogue.
10+
*/
11+
service Access {
12+
13+
/*
14+
Resets and generate a new administration token.
15+
Returns the new administration token.
16+
*/
17+
rpc ResetAdministrationToken (google.protobuf.Empty) returns (google.protobuf.StringValue);
18+
/*
19+
Get the current administration token.
20+
Returns the current administration token.
21+
*/
22+
rpc GetAdministrationToken (google.protobuf.Empty) returns (google.protobuf.StringValue);
23+
/*
24+
Get the current administration certificate.
25+
Returns the current administration certificate.
26+
*/
27+
rpc GetAdministrationCertificate (google.protobuf.Empty) returns (google.protobuf.StringValue);
28+
/*
29+
Get a command line set to execute to configure a new remote client.
30+
Returns command line instructions in one string
31+
*/
32+
rpc GetAdministrationCLIs (google.protobuf.Empty) returns (google.protobuf.StringValue);
33+
34+
/*
35+
Create a new user access with a fresh token and a empty access list.
36+
Returns the newly created UserAccess.
37+
*/
38+
rpc CreateUserAccess (google.protobuf.Empty) returns (UserAccess);
39+
/*
40+
Get user access details given its integer ID.
41+
Params: the user access integer ID.
42+
Returns the request UserAccess if it exists.
43+
*/
44+
rpc GetUserAccess (google.protobuf.Int32Value) returns (UserAccess);
45+
/*
46+
Get a user access list.
47+
Returns the UserAccess list.
48+
*/
49+
rpc ListUserAccesses (google.protobuf.Empty) returns (UserAccessList);
50+
/*
51+
Delete a user access given its integer ID.
52+
Params: the user access integer ID.
53+
*/
54+
rpc DeleteUserAccess (google.protobuf.Int32Value) returns (google.protobuf.Empty);
55+
/*
56+
Reset the token a specific user access given its integer ID.
57+
Returns the UserAccess with its new token.
58+
*/
59+
rpc ResetUserAccessToken (google.protobuf.Int32Value) returns (UserAccess);
60+
/*
61+
Get a dictionary of all available permissions.
62+
Returns the ServiceAccess dictionary.
63+
*/
64+
rpc GetPermissionList (google.protobuf.Empty) returns (ServiceAccess);
65+
/*
66+
Set a batch of permissions changes for the given user access ID.
67+
Changes may be a list of 'set', 'add' or 'remove'.
68+
Returns the updated UserAccess.
69+
*/
70+
rpc SetUserAccessPermissions (PermissionChanges) returns (UserAccess);
71+
}
72+
73+
message MethodAccess {
74+
repeated string permission = 1;
75+
}
76+
77+
message ServiceAccess {
78+
map<string, MethodAccess> services = 3;
79+
}
80+
81+
message UserAccess {
82+
int32 idx = 1;
83+
string token = 2;
84+
ServiceAccess permissions = 3;
85+
}
86+
87+
message UserAccessList {
88+
repeated UserAccess user_accesses = 1;
89+
}
90+
91+
message PermissionChanges {
92+
int32 user_access_idx = 1;
93+
optional ServiceAccess sets = 2;
94+
optional ServiceAccess adds = 3;
95+
optional ServiceAccess removes = 4;
96+
}

src/protos/pirogue_admin_api/network.proto

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,36 @@ package pirogue.admin.network;
55
import "google/protobuf/empty.proto";
66
import "google/protobuf/wrappers.proto";
77

8+
/*
9+
Manage network related features on this PiRogue.
10+
*/
811
service Network {
9-
/* VPN */
12+
13+
/*
14+
Get a list of active VPN peers.
15+
Returns a list of VPNPeer.
16+
*/
1017
rpc ListVPNPeers (google.protobuf.Empty) returns (VPNPeerList) {}
18+
/*
19+
Get details about a given VPN peer ID.
20+
Returns the VPNPeer details.
21+
*/
1122
rpc GetVPNPeer (google.protobuf.Int32Value) returns (VPNPeer) {}
1223
rpc GetVPNPeerConfig (google.protobuf.Int32Value) returns (google.protobuf.StringValue) {}
1324
rpc AddVPNPeer (VPNPeerAddRequest) returns (VPNPeer) {}
1425
rpc DeleteVPNPeer (google.protobuf.Int32Value) returns (VPNPeer) {}
1526

16-
/* WiFi */
27+
/*
28+
Get current WiFi configuration.
29+
Returns a WifiConfiguration dictionary.
30+
*/
1731
rpc GetWifiConfiguration (google.protobuf.Empty) returns (WifiConfiguration) {}
32+
/*
33+
Set a new WiFi configuration.
34+
Params: the WifiConfiguration dictionary to use as new configuration.
35+
*/
1836
rpc SetWifiConfiguration (WifiConfiguration) returns (google.protobuf.Empty) {}
1937

20-
/* External administration */
21-
rpc ResetAdministrationToken (google.protobuf.Empty) returns (google.protobuf.StringValue) {}
22-
rpc GetAdministrationToken (google.protobuf.Empty) returns (google.protobuf.StringValue) {}
23-
rpc GetAdministrationCertificate (google.protobuf.Empty) returns (google.protobuf.StringValue) {}
24-
rpc GetAdministrationCLIs (google.protobuf.Empty) returns (google.protobuf.StringValue) {}
25-
2638
/* External access */
2739
rpc EnableExternalPublicAccess (PublicAccessRequest) returns (google.protobuf.Empty) {}
2840
rpc DisableExternalPublicAccess (google.protobuf.Empty) returns (google.protobuf.Empty) {}

src/python/debian/changelog

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
python3-pirogue-admin-api (2.0.2) UNRELEASED; urgency=medium
1+
python3-pirogue-admin-api (2.0.3) bookworm; urgency=medium
22

33
* Improved package info message.
44
* More versatile status info message.
5+
* Adds access service to manage user tokens
56

6-
-- Christophe Andral <christophe@andral.fr> Fri, 02 Dec 2025 08:57:48 +0100
7+
-- Christophe Andral <christophe@andral.fr> Thu, 12 Feb 2026 15:22:51 +0100
78

89
python3-pirogue-admin-api (2.0.1) bookworm; urgency=medium
910

src/python/pirogue_admin_api/access_pb2.py

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
from google.protobuf import empty_pb2 as _empty_pb2
2+
from google.protobuf import wrappers_pb2 as _wrappers_pb2
3+
from google.protobuf.internal import containers as _containers
4+
from google.protobuf import descriptor as _descriptor
5+
from google.protobuf import message as _message
6+
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
7+
8+
DESCRIPTOR: _descriptor.FileDescriptor
9+
10+
class MethodAccess(_message.Message):
11+
__slots__ = ["permission"]
12+
PERMISSION_FIELD_NUMBER: _ClassVar[int]
13+
permission: _containers.RepeatedScalarFieldContainer[str]
14+
def __init__(self, permission: _Optional[_Iterable[str]] = ...) -> None: ...
15+
16+
class PermissionChanges(_message.Message):
17+
__slots__ = ["adds", "removes", "sets", "user_access_idx"]
18+
ADDS_FIELD_NUMBER: _ClassVar[int]
19+
REMOVES_FIELD_NUMBER: _ClassVar[int]
20+
SETS_FIELD_NUMBER: _ClassVar[int]
21+
USER_ACCESS_IDX_FIELD_NUMBER: _ClassVar[int]
22+
adds: ServiceAccess
23+
removes: ServiceAccess
24+
sets: ServiceAccess
25+
user_access_idx: int
26+
def __init__(self, user_access_idx: _Optional[int] = ..., sets: _Optional[_Union[ServiceAccess, _Mapping]] = ..., adds: _Optional[_Union[ServiceAccess, _Mapping]] = ..., removes: _Optional[_Union[ServiceAccess, _Mapping]] = ...) -> None: ...
27+
28+
class ServiceAccess(_message.Message):
29+
__slots__ = ["services"]
30+
class ServicesEntry(_message.Message):
31+
__slots__ = ["key", "value"]
32+
KEY_FIELD_NUMBER: _ClassVar[int]
33+
VALUE_FIELD_NUMBER: _ClassVar[int]
34+
key: str
35+
value: MethodAccess
36+
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[MethodAccess, _Mapping]] = ...) -> None: ...
37+
SERVICES_FIELD_NUMBER: _ClassVar[int]
38+
services: _containers.MessageMap[str, MethodAccess]
39+
def __init__(self, services: _Optional[_Mapping[str, MethodAccess]] = ...) -> None: ...
40+
41+
class UserAccess(_message.Message):
42+
__slots__ = ["idx", "permissions", "token"]
43+
IDX_FIELD_NUMBER: _ClassVar[int]
44+
PERMISSIONS_FIELD_NUMBER: _ClassVar[int]
45+
TOKEN_FIELD_NUMBER: _ClassVar[int]
46+
idx: int
47+
permissions: ServiceAccess
48+
token: str
49+
def __init__(self, idx: _Optional[int] = ..., token: _Optional[str] = ..., permissions: _Optional[_Union[ServiceAccess, _Mapping]] = ...) -> None: ...
50+
51+
class UserAccessList(_message.Message):
52+
__slots__ = ["user_accesses"]
53+
USER_ACCESSES_FIELD_NUMBER: _ClassVar[int]
54+
user_accesses: _containers.RepeatedCompositeFieldContainer[UserAccess]
55+
def __init__(self, user_accesses: _Optional[_Iterable[_Union[UserAccess, _Mapping]]] = ...) -> None: ...

0 commit comments

Comments
 (0)