Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
476 commits
Select commit Hold shift + click to select a range
5468eae
wip(go): wire ctx in extclient apis;
VishalDalwadi Jul 16, 2026
a5778bd
wip(go): wire ctx in extclient apis;
VishalDalwadi Jul 16, 2026
ce0ffd1
wip(go): remove org id check from global scoped get tenant api;
VishalDalwadi Jul 17, 2026
7c8bda4
wip(go): add scope slug to discover response;
VishalDalwadi Jul 17, 2026
c1323fe
wip(go): wire ctx in get users;
VishalDalwadi Jul 17, 2026
7362717
wip(go): set tenant id in posture check violations;
VishalDalwadi Jul 17, 2026
d8e3740
wip(go): upsert membership instead of user;
VishalDalwadi Jul 17, 2026
7533081
wip(go): pass correct len;
VishalDalwadi Jul 17, 2026
b1800a5
wip(go): optimize (single loop);
VishalDalwadi Jul 17, 2026
4df1935
wip(go): unify todos;
VishalDalwadi Jul 17, 2026
5f3845b
wip(go): add todo;
VishalDalwadi Jul 17, 2026
f0e3afd
wip(go): wire context for network get;
VishalDalwadi Jul 17, 2026
822feff
wip(go): wire context;
VishalDalwadi Jul 17, 2026
57397bf
wip(go): wire context;
VishalDalwadi Jul 18, 2026
79b3816
wip(go): wire ctx when getting tenant superadmin;
VishalDalwadi Jul 20, 2026
19acfe9
wip(go): add network creator to network admin group;
VishalDalwadi Jul 20, 2026
b5d2ea8
wip(go): check for user membership on sync;
VishalDalwadi Jul 20, 2026
36e8b0a
wip(go): add methods with strict membership check;
VishalDalwadi Jul 20, 2026
075f045
wip(go): remove unwanted feature flags;
VishalDalwadi Jul 21, 2026
e294b6f
wip(go): report per-tenant usage during license validation;
VishalDalwadi Jul 21, 2026
d29bfa2
wip(go): move email setting from tenant to org;
VishalDalwadi Jul 21, 2026
5924d20
wip(go): pass org scope to email init;
VishalDalwadi Jul 21, 2026
20f0019
wip(go): remove old tenant email settings usages; use org settings to…
VishalDalwadi Jul 21, 2026
8fb6c50
wip(go): use get email settings from org settings;
VishalDalwadi Jul 21, 2026
ac6ec69
wip(go): remove email settings migration;
VishalDalwadi Jul 21, 2026
3abccf9
wip(go): migrate email settings from server to org settings;
VishalDalwadi Jul 21, 2026
b1e322d
wip(go): assign global network admin group membership only for super-…
VishalDalwadi Jul 21, 2026
558b873
wip(go): assign global network admin group membership only for super-…
VishalDalwadi Jul 21, 2026
27b85b1
wip(go): add membership alias to filter;
VishalDalwadi Jul 21, 2026
f7c5004
wip(go): skip clearing local license validation response cache;
VishalDalwadi Jul 21, 2026
4d3c18c
wip(go): extend license validation response for multi-tenancy;
VishalDalwadi Jul 21, 2026
b2e293a
wip(go): add functions to get sole tenant and org;
VishalDalwadi Jul 21, 2026
ea62d78
wip(go): use tenant-specific feature flags;
VishalDalwadi Jul 21, 2026
b644ed2
wip(go): add tenant status type;
VishalDalwadi Jul 21, 2026
c9fe29b
wip(go): remove old hook comment;
VishalDalwadi Jul 21, 2026
793ffec
wip(go): expect ctx during license validation;
VishalDalwadi Jul 21, 2026
676ef17
wip(go): always create default org and tenant for ce;
VishalDalwadi Jul 21, 2026
ac40166
wip(go): add tenant-specific check for license validation error;
VishalDalwadi Jul 21, 2026
9fa9ffe
wip(go): cache license validation response in memory;
VishalDalwadi Jul 21, 2026
7e9a1bd
wip(go): add todo to handle multiple-tenant for integration pull;
VishalDalwadi Jul 21, 2026
44994f6
wip(go): pass ctx during license validation;
VishalDalwadi Jul 21, 2026
28b8dda
wip(go): add todo for making changes later; run hook separately for e…
VishalDalwadi Jul 21, 2026
82cfd64
wip(go): return specific errors when license validation response not …
VishalDalwadi Jul 21, 2026
07b7a6c
wip(go): use retryable.httpclient for calling license validation api;
VishalDalwadi Jul 21, 2026
2533aa6
wip(go): process license validation;
VishalDalwadi Jul 21, 2026
15e9ba7
wip(go): license validation function;
VishalDalwadi Jul 21, 2026
ce93de9
wip(go): migration on license validation;
VishalDalwadi Jul 21, 2026
402f425
wip(go): org settings not expected;
VishalDalwadi Jul 22, 2026
20bd32d
Merge branch 'NM-341-v4' of https://github.com/gravitl/netmaker into …
VishalDalwadi Jul 22, 2026
473ab63
Merge pull request #4100 from gravitl/NM-341-v7
VishalDalwadi Jul 22, 2026
9d237ee
wip(go): remove expiry from license validation response;
VishalDalwadi Jul 22, 2026
ed0b5b5
wip(go): add limits and limits enforcement to license validation resp…
VishalDalwadi Jul 22, 2026
ebe684f
wip(go): remove expiry usages;
VishalDalwadi Jul 22, 2026
023bf55
wip(go): add arg to clear cache;
VishalDalwadi Jul 22, 2026
5ba7afc
wip(go): add arg to clear cache;
VishalDalwadi Jul 22, 2026
3e2e9df
wip(go): skip license validation if cached resp;
VishalDalwadi Jul 22, 2026
be3f9c4
wip(go): allow org_id and tenant_id query params;
VishalDalwadi Jul 22, 2026
59ec777
wip(go): upsert tenant membership on sync;
VishalDalwadi Jul 22, 2026
26ad4bc
wip(go): pass ctx to delete network roles;
VishalDalwadi Jul 22, 2026
5baa752
wip(go): create tenant membership on org owner creation on ce;
VishalDalwadi Jul 22, 2026
9244f8d
wip(go): add tenant orchestrator;
VishalDalwadi Jul 22, 2026
de0feb3
wip(go): use tenant orchestrator;
VishalDalwadi Jul 22, 2026
bafe710
wip(go): add default settings for tenant;
VishalDalwadi Jul 22, 2026
bf2f863
wip(go): make org owner superadmin on all tenants;
VishalDalwadi Jul 22, 2026
a294027
wip(go): simplify SyncOrgAndTenants;
VishalDalwadi Jul 22, 2026
6a9f08f
wip(go): retry license validation only 3 times
VishalDalwadi Jul 22, 2026
ce12567
wip(go): store invalid err;
VishalDalwadi Jul 22, 2026
f55216a
wip(go): add function to check if limits are to be enforced on a tenant;
VishalDalwadi Jul 22, 2026
64e0f72
Merge branch 'NM-341-v4' of https://github.com/gravitl/netmaker into …
VishalDalwadi Jul 22, 2026
68dbe80
wip(go): pass tenant scope if possible when checking for license vali…
VishalDalwadi Jul 22, 2026
40906de
wip(go): remove merge errors;
VishalDalwadi Jul 22, 2026
8911d05
wip(go): add functions for limit checks;
VishalDalwadi Jul 22, 2026
e0e1d74
wip(go): wire host limit check;
VishalDalwadi Jul 22, 2026
58ac0f1
wip(go): wire ingress limit check;
VishalDalwadi Jul 22, 2026
c7232f3
wip(go): wire egress limit check;
VishalDalwadi Jul 22, 2026
e9b2b98
wip(go): wire client limit check;
VishalDalwadi Jul 22, 2026
2c5bf70
wip(go): wire network limit check;
VishalDalwadi Jul 22, 2026
97e78d1
wip(go): wire user limit check;
VishalDalwadi Jul 22, 2026
1d1d015
wip(go): use correct errors;
VishalDalwadi Jul 23, 2026
c7614bd
wip(go): skip telemetry for msps;
VishalDalwadi Jul 23, 2026
75e10de
wip(go): disable telemetry on msp tenants;
VishalDalwadi Jul 23, 2026
02ed915
wip(go): err check;
VishalDalwadi Jul 23, 2026
d0bb11a
wip(go): uncomment log event;
VishalDalwadi Jul 23, 2026
a7bf546
Merge branch 'NM-341-v4' of https://github.com/gravitl/netmaker into …
VishalDalwadi Jul 23, 2026
d5beee4
wip(go): get sso state to get scope for non-headless oauth login;
VishalDalwadi Jul 23, 2026
7cbb243
wip(go): inline delete pending user;
VishalDalwadi Jul 23, 2026
28b396a
wip(go): allow both org and tenant scope for pending users table;
VishalDalwadi Jul 23, 2026
3f06df1
wip(go): add migration for pending user table during set tenant id an…
VishalDalwadi Jul 23, 2026
e6b5087
wip(go): update queries to use new scope fields in pending users table;
VishalDalwadi Jul 23, 2026
534a4b7
wip(go): allow both org and tenant scope for user invites table;
VishalDalwadi Jul 23, 2026
3012fcc
wip(go): update queries to use new scope fields;
VishalDalwadi Jul 23, 2026
aa13d5f
wip(go): add migration for rekey-ing org/tenant id and setting tenant…
VishalDalwadi Jul 23, 2026
7fa9b68
wip(go): inline delete user invite;
VishalDalwadi Jul 23, 2026
768a646
wip(go): set scope when creating invite;
VishalDalwadi Jul 23, 2026
3ae8fd8
wip(go): get user count with membership is ctx is tenant scoped;
VishalDalwadi Jul 25, 2026
bf194db
wip(go): add methods to upsert and delete org memberships;
VishalDalwadi Jul 25, 2026
b4bf05a
wip(go): add global valid tenant and org roles map;
VishalDalwadi Jul 25, 2026
5c1c245
wip(go): add scope query in user invite get by email;
VishalDalwadi Jul 25, 2026
66f11f5
wip(go): add support for upsert and delete of org and tenant membersh…
VishalDalwadi Jul 25, 2026
d8d14b6
wip(go): infer scope for user invite apis;
VishalDalwadi Jul 25, 2026
6f715dd
wip(go): wire ctx in get user invite by email;
VishalDalwadi Jul 25, 2026
96f01c8
wip(go): allow no scope headers to be passed in infer scope apis;
VishalDalwadi Jul 25, 2026
22a9a60
wip(go): add validation and checks for org-scoped invite api handlers;
VishalDalwadi Jul 25, 2026
31293e9
wip(go): wire ctx to is pending user check;
VishalDalwadi Jul 25, 2026
0a2c535
wip(go): infer scope for pending user apis;
VishalDalwadi Jul 25, 2026
79dccc6
wip(go): set default role based on ctx scope;
VishalDalwadi Jul 25, 2026
445c299
wip(go): move mfa to tenant membership table; move account status to …
VishalDalwadi Jul 25, 2026
932eb79
wip(go): migrate account status and mfa settings;
VishalDalwadi Jul 25, 2026
3dd5875
wip(go): update account status on sync;
VishalDalwadi Jul 25, 2026
1be4975
wip(go): use update mfa to update mfa setting;
VishalDalwadi Jul 25, 2026
89c9f16
wip(go): set new membership settings on user creation;
VishalDalwadi Jul 25, 2026
aeb3e78
wip(go): use membership where required;
VishalDalwadi Jul 27, 2026
df69e36
wip(go): wire ctx on key unlink refs;
VishalDalwadi Jul 27, 2026
02a6fa7
wip(go): use r.Context directly without reinitializing db;
VishalDalwadi Jul 27, 2026
a927bd9
wip(go): wire ctx in acls;
VishalDalwadi Jul 27, 2026
627573f
wip(go): add tenant scoped primary key constructor;
VishalDalwadi Jul 27, 2026
ff00039
wip(go): use tenant scoped primary key for acls, dns, extclients and …
VishalDalwadi Jul 27, 2026
6af5402
wip(go): wire ctx for get groups in network;
VishalDalwadi Jul 27, 2026
6a999ea
wip(go): wire ctx for get groups;
VishalDalwadi Jul 27, 2026
4ce893d
wip(go): scope non-uuid group ids by tenant id;
VishalDalwadi Jul 27, 2026
914e3ba
wip(go): migrate non-uuid group ids to scoped ids;
VishalDalwadi Jul 27, 2026
84cfffd
wip(go): don't expect scope id in invite validation and signup apis;
VishalDalwadi Jul 27, 2026
3ce20b2
wip(go): wire ctx for get matching user; allow org scope when queryin…
VishalDalwadi Jul 27, 2026
1bcc2d2
wip(go): add mfa to org;
VishalDalwadi Jul 27, 2026
60a0931
wip(go): scope preauth token;
VishalDalwadi Jul 27, 2026
2913b20
wip(go): add fallback for older auth tokens;
VishalDalwadi Jul 27, 2026
2fefd20
wip(go): wire ctx for preauth token creation;
VishalDalwadi Jul 27, 2026
4d28aaa
wip(go): migrate mfa settings;
VishalDalwadi Jul 27, 2026
f2fe31f
wip(go): resolve mfa settings for inherited auth;
VishalDalwadi Jul 27, 2026
84cceba
wip(go): update mfa for org;
VishalDalwadi Jul 27, 2026
6bc0a8c
wip(go): infer scope for totp apis;
VishalDalwadi Jul 27, 2026
8aa37dd
Merge branch 'NM-341-v6' of https://github.com/gravitl/netmaker into …
VishalDalwadi Jul 27, 2026
0e21bb5
wip(go): use ctx when passed;
VishalDalwadi Jul 27, 2026
b99af29
wip(go): infer scope for list user apis;
VishalDalwadi Jul 27, 2026
7a498d0
wip(go): ensure set primary keys don't cause errors during fetch;
VishalDalwadi Jul 27, 2026
d75e12f
wip(go): make primary key for integrations uuid and store provider in…
VishalDalwadi Jul 28, 2026
1eb7578
wip(go): migrate integration ids;
VishalDalwadi Jul 28, 2026
467266c
wip(go): use provider instead of id everywhere;
VishalDalwadi Jul 28, 2026
acb970b
wip(go): remove gorm column;
VishalDalwadi Jul 28, 2026
f9410af
Merge branch 'develop' of https://github.com/gravitl/netmaker into NM…
VishalDalwadi Jul 28, 2026
b7091ea
wip(go): wire ctx for igw egress creation;
VishalDalwadi Jul 28, 2026
3e0aa71
wip(go): wire ctx for igw egress update;
VishalDalwadi Jul 28, 2026
a0cd801
wip(go): wire ctx for host registration;
VishalDalwadi Jul 28, 2026
f21e875
wip(go): wire ctx for host registration;
VishalDalwadi Jul 28, 2026
c2f6c51
wip(go): merge errors;
VishalDalwadi Jul 28, 2026
51fe2a6
Merge branch 'NM-341-v4' of https://github.com/gravitl/netmaker into …
VishalDalwadi Jul 28, 2026
cb6b8fd
wip(go): merge errors;
VishalDalwadi Jul 28, 2026
def373e
wip(go): wire ctx; remove default scope usages;
VishalDalwadi Jul 28, 2026
109e9f2
wip(go): use get with membership;
VishalDalwadi Jul 28, 2026
25883e0
wip(go): org scope license validation;
VishalDalwadi Jul 28, 2026
3b38f10
wip(go): remove debug log;
VishalDalwadi Jul 28, 2026
cd162ce
wip(go): remove scoping on list roles;
VishalDalwadi Jul 28, 2026
4952e33
wip(go): ignore invite creation if already exists;
VishalDalwadi Jul 29, 2026
1db706c
wip(go): add is msp func to check if deployment is msp deployment;
VishalDalwadi Jul 29, 2026
2819a80
wip(go): ensure username is email for msp users;
VishalDalwadi Jul 29, 2026
24c59b6
Merge branch 'NM-341-v6' of https://github.com/gravitl/netmaker into …
VishalDalwadi Jul 29, 2026
68448cd
wip(go): add email validated check on user table;
VishalDalwadi Jul 29, 2026
4723b75
wip(go): mark email validated when oauth user;
VishalDalwadi Jul 29, 2026
369f72e
wip(go): handle gorm error;
VishalDalwadi Jul 29, 2026
0c69960
wip(go): add tenant id to siem grpc schema;
VishalDalwadi Jul 29, 2026
83f40c8
wip(go): read tenant from scoped ctx;
VishalDalwadi Jul 29, 2026
132f4e3
wip(go): pass scoped ctx to siem grpc client;
VishalDalwadi Jul 29, 2026
104fe6b
wip(go): remove unused publisher;
VishalDalwadi Jul 29, 2026
ed5a96a
wip(go): publish all tenant exporter updates on pull;
VishalDalwadi Jul 29, 2026
09a473b
wip(go): fix wg usage;
VishalDalwadi Jul 29, 2026
e3b076e
wip(go): tenant scope the ctx when getting server info;
VishalDalwadi Jul 29, 2026
212ea3d
wip(go): add tenant id to enrollment key token;
VishalDalwadi Jul 30, 2026
28cbda3
wip(go): make host register tenant scope;
VishalDalwadi Jul 30, 2026
0469974
wip(go): add default settings;
VishalDalwadi Jul 30, 2026
5a44c68
wip(go): use correct checks for is msp tenant;
VishalDalwadi Jul 30, 2026
daaa410
wip(go): add email validation extension;
VishalDalwadi Jul 30, 2026
2c2dcfc
wip(go): add pages for validation check;
VishalDalwadi Jul 30, 2026
3ba1c37
wip(go): use extension for validating user;
VishalDalwadi Jul 30, 2026
b55c55a
wip(go): add invite type;
VishalDalwadi Jul 30, 2026
3bec55b
wip(go): create only one validation invite per user email;
VishalDalwadi Jul 30, 2026
de7a5be
wip(go): add validate email handler;
VishalDalwadi Jul 30, 2026
ff5737c
wip(go): add email builder;
VishalDalwadi Jul 30, 2026
c6a5c87
wip(go): add user invite type migration logic;
VishalDalwadi Jul 30, 2026
3d53e31
wip(go): only log email send failures;
VishalDalwadi Jul 30, 2026
1316a77
wip(go): add tenant id to flows table;
VishalDalwadi Jul 30, 2026
059160f
wip(go): add func to check if connected to clickhouse;
VishalDalwadi Jul 30, 2026
15ae726
wip(go): migrate clickhouse;
VishalDalwadi Jul 30, 2026
39130f3
wip(go): add tenant id to mdm and edr state;
VishalDalwadi Jul 30, 2026
980948d
wip(go): add delete methods for tables;
VishalDalwadi Jul 30, 2026
06464fe
wip(go): add tenant teardown method;
VishalDalwadi Jul 30, 2026
87ab866
wip(go): handle tenant deletion;
VishalDalwadi Jul 30, 2026
3f3fe75
Merge branch 'NM-341-v6' of https://github.com/gravitl/netmaker into …
VishalDalwadi Jul 30, 2026
d51426f
wip(go): clean up flow logs on tenant deletion;
VishalDalwadi Jul 30, 2026
03ef29c
wip(go): add update org membership role id method;
VishalDalwadi Jul 31, 2026
4c9fb96
wip(go): add transfer org ownership api;
VishalDalwadi Jul 31, 2026
5030040
wip(go): move audit logs retention period to org settings;
VishalDalwadi Aug 1, 2026
d97b40e
wip(go):get retention period from org settings;
VishalDalwadi Aug 1, 2026
be5848a
wip(go): remove old audit logs usage;
VishalDalwadi Aug 1, 2026
629f2ff
wip(go): migrate audit logs retention period;
VishalDalwadi Aug 1, 2026
b9993ba
wip(go): unmarshal decodes nums as float64;
VishalDalwadi Aug 1, 2026
ebfd275
wip(go): run flow logs cleanup for all tenants in one go;
VishalDalwadi Aug 1, 2026
95dcedf
wip(go): add audit logs retention period and smtp settings to tenant …
VishalDalwadi Aug 1, 2026
9db2b99
wip(go): resolve retention period and smtp settings correctly;
VishalDalwadi Aug 1, 2026
da59cd1
wip(go): handle retention period and smtp settings updates and fetche…
VishalDalwadi Aug 1, 2026
f17a456
wip(go): overlay retention period and smtp settings on server settings;;
VishalDalwadi Aug 1, 2026
aad44c8
wip(go): upsert overlayed settings;
VishalDalwadi Aug 1, 2026
c18b40d
wip(go): add azure tenant id to org settings;
VishalDalwadi Aug 3, 2026
83faa74
wip(go): tenant scope list roles;
VishalDalwadi Aug 3, 2026
d55f5af
wip(go): add noop creds;
VishalDalwadi Aug 3, 2026
0efe299
wip(go): use first instead of find;
VishalDalwadi Aug 3, 2026
e8aa65c
wip(go): use correct roles when transfering ownership;
VishalDalwadi Aug 4, 2026
3519738
wip(go): delete access tokens only if tenant scoped;
VishalDalwadi Aug 4, 2026
efcbe2b
wip(go): make delete user work for both org and tenant scope;
VishalDalwadi Aug 4, 2026
e1d0c4a
wip(go): delete extclients only if tenant scoped;
VishalDalwadi Aug 4, 2026
7f0cc6f
wip(go): check if caller is allowed to delete user;
VishalDalwadi Aug 4, 2026
3760cd3
wip(go): infer scope for update user;
VishalDalwadi Aug 4, 2026
2250e03
wip(go): prevent org-owner elevation;
VishalDalwadi Aug 4, 2026
01832fa
wip(go): permissions check for update;
VishalDalwadi Aug 4, 2026
00a7744
wip(go): delete user access tokens only if tenant scope;
VishalDalwadi Aug 4, 2026
8fcbaf6
wip(go): delete extclients only if tenant scope;
VishalDalwadi Aug 4, 2026
8ea77e0
wip(go): move upsert membership in upsert user;
VishalDalwadi Aug 4, 2026
f938eb8
wip(go): set api host when constructing server config;
VishalDalwadi Aug 5, 2026
533e817
wip(go): fix static errors;
VishalDalwadi Aug 5, 2026
24e2bf1
wip(go): fix test cases;
VishalDalwadi Aug 5, 2026
6ee9eb2
wip(go): use correct get ns order;
VishalDalwadi Aug 5, 2026
cc48b3c
wip(go): use correct get pending host order;
VishalDalwadi Aug 5, 2026
97527bb
wip(go): use correct get access token order;
VishalDalwadi Aug 5, 2026
2d83203
wip(go): use correct get event order;
VishalDalwadi Aug 5, 2026
5065848
wip(go): return error response on emqx user creation error;
VishalDalwadi Aug 5, 2026
f593f7a
wip(go): store correct value in cache;
VishalDalwadi Aug 5, 2026
5aa1b29
wip(go): return better error response;
VishalDalwadi Aug 5, 2026
331c43d
wip(go): return better error response;
VishalDalwadi Aug 5, 2026
7610a81
wip(go): use cache when listing egress acls;
VishalDalwadi Aug 5, 2026
5a305cc
wip(go): wire ctx in UserHasNetworkGroupAccess;
VishalDalwadi Aug 5, 2026
e2b7af6
wip(go): remove double scope wrapping;
VishalDalwadi Aug 5, 2026
2633d8d
wip(go): add security check for list and get org;
VishalDalwadi Aug 5, 2026
be0bbc2
wip(go): ratelimit discover api;
VishalDalwadi Aug 5, 2026
6082b41
wip(go): expect sole org id in get and create org owner;
VishalDalwadi Aug 5, 2026
594cb82
wip(go): wrap create org owner in tx;
VishalDalwadi Aug 5, 2026
c404ad4
wip(go): wire ctx correctly;
VishalDalwadi Aug 5, 2026
7ba579e
wip(go): wire ctx for posture check functions;
VishalDalwadi Aug 5, 2026
4341e56
wip(go): remove resolved todo;
VishalDalwadi Aug 5, 2026
257e707
wip(go): wire ctx for posture check function;
VishalDalwadi Aug 5, 2026
eccd17f
wip(go): remove scope from netdesk login api;
VishalDalwadi Aug 6, 2026
d7f9d26
Merge branch 'NM-341-v6' of https://github.com/gravitl/netmaker into …
VishalDalwadi Aug 6, 2026
e7fdf96
Merge branch 'develop' of https://github.com/gravitl/netmaker into NM…
VishalDalwadi Aug 6, 2026
2dc1840
wip(go): use orgid correctly;
VishalDalwadi Aug 6, 2026
e52d8f1
wip(go): scope user update checks correctly;
VishalDalwadi Aug 6, 2026
61d12f0
wip(go): wire ctx for fetch oauth secret;
VishalDalwadi Aug 6, 2026
1942fe4
wip(go): add tenant_id and org_id query string param to user invite url;
VishalDalwadi Aug 6, 2026
a398bc4
wip(go): get sole org;
VishalDalwadi Aug 6, 2026
611f6cc
wip(go): set query string correctly;
VishalDalwadi Aug 6, 2026
ebe3eb2
wip(go): wire ctx in update user groups;
VishalDalwadi Aug 10, 2026
6a0642c
wip(go): allow delete oauth non-idp users;
VishalDalwadi Aug 10, 2026
ebd8576
wip(go): delete access tokens post update but check before update;
VishalDalwadi Aug 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions auth/host_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ func joinHostToNetworks(ctx context.Context, key models.EnrollmentKey, host *sch
}

violations, _ := logic.CheckPostureViolationsForHost(
ctx,
host,
keyTags,
schema.NetworkID(network.Name),
Expand Down
2 changes: 1 addition & 1 deletion controllers/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func getDeviceNetworks(w http.ResponseWriter, r *http.Request) {
}
// Ownership mismatch must not block the network list; host-scoped state is omitted without a verified host.
}
networks, err := logic.GetDeviceNetworks(db.WithContext(r.Context()), user, host)
networks, err := logic.GetDeviceNetworks(r.Context(), user, host)
if err != nil {
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
return
Expand Down
2 changes: 1 addition & 1 deletion controllers/enrollmentkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ func handleHostRegister(w http.ResponseWriter, r *http.Request) {

var joinNetworks []string
for _, netI := range enrollmentKey.Networks {
violations, _ := logic.CheckPostureViolationsForHost(&newHost, keyTags, schema.NetworkID(netI), true)
violations, _ := logic.CheckPostureViolationsForHost(r.Context(), &newHost, keyTags, schema.NetworkID(netI), true)
if len(violations) == 0 {
joinNetworks = append(joinNetworks, netI)
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/ext_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
if extclient.DeviceID != "" {
// check for violations connecting from desktop app
staticNode := models.ConvertToStaticNode(extclient)
violations, _ := logic.CheckPostureViolations(logic.GetPostureCheckDeviceInfoByNode(&staticNode), schema.NetworkID(extclient.Network))
violations, _ := logic.CheckPostureViolations(r.Context(), logic.GetPostureCheckDeviceInfoByNode(&staticNode), schema.NetworkID(extclient.Network))
if len(violations) > 0 {
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("posture check violations"), logic.Forbidden))
return
Expand Down Expand Up @@ -927,7 +927,7 @@ func updateExtClient(w http.ResponseWriter, r *http.Request) {
if newclient.DeviceID != "" && newclient.Enabled {
// check for violations connecting from desktop app
staticNode := models.ConvertToStaticNode(newclient)
violations, _ := logic.CheckPostureViolations(logic.GetPostureCheckDeviceInfoByNode(&staticNode), schema.NetworkID(newclient.Network))
violations, _ := logic.CheckPostureViolations(r.Context(), logic.GetPostureCheckDeviceInfoByNode(&staticNode), schema.NetworkID(newclient.Network))
if len(violations) > 0 {
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("posture check violations"), logic.Forbidden))
return
Expand Down
8 changes: 4 additions & 4 deletions controllers/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ func hostUpdateFallback(w http.ResponseWriter, r *http.Request) {
)
for _, _node := range _nodes {
node := logic.ConvertSchemaNodeToModelsNode(&_node)
node.PostureChecksViolations, node.PostureCheckViolationSeverityLevel = logic.CheckPostureViolations(logic.GetPostureCheckDeviceInfoByNode(node), schema.NetworkID(node.Network))
node.PostureChecksViolations, node.PostureCheckViolationSeverityLevel = logic.CheckPostureViolations(ctx, logic.GetPostureCheckDeviceInfoByNode(node), schema.NetworkID(node.Network))
_node.PostureCheckSeverity = node.PostureCheckViolationSeverityLevel
_node.PostureCheckLastEvaluationCycleID = uuid.NewString()
_node.PostureCheckLastEvaluatedAt = time.Now().UTC()
Expand Down Expand Up @@ -977,7 +977,7 @@ func addHostToNetwork(w http.ResponseWriter, r *http.Request) {
return
}

violations, _ := logic.CheckPostureViolationsForHost(host, nil, schema.NetworkID(networkID), true)
violations, _ := logic.CheckPostureViolationsForHost(r.Context(), host, nil, schema.NetworkID(networkID), true)
if len(violations) > 0 {
logic.ReturnErrorResponseWithJson(w, r, violations, logic.FormatError(errors.New("posture check violations"), logic.BadReq))
return
Expand Down Expand Up @@ -1871,7 +1871,7 @@ func approvePendingHost(w http.ResponseWriter, r *http.Request) {
keyTags[models.TagID(tagI)] = struct{}{}
}

violations, _ := logic.CheckPostureViolationsForHost(host, keyTags, schema.NetworkID(network.Name), true)
violations, _ := logic.CheckPostureViolationsForHost(r.Context(), host, keyTags, schema.NetworkID(network.Name), true)
if len(violations) > 0 {
err = fmt.Errorf("failed to approve pending host (%s): posture check violations", id)
logger.Log(0, err.Error())
Expand Down Expand Up @@ -1939,7 +1939,7 @@ func addDefaultHostToNetworks(ctx context.Context, host *schema.Host) {
continue
}

violations, _ := logic.CheckPostureViolationsForHost(host, make(map[models.TagID]struct{}), schema.NetworkID(network.Name), true)
violations, _ := logic.CheckPostureViolationsForHost(ctx, host, make(map[models.TagID]struct{}), schema.NetworkID(network.Name), true)
if len(violations) > 0 {
logger.Log(2, "skipping network", network.Name, "for default host", host.Name, ": posture check violations")
continue
Expand Down
16 changes: 13 additions & 3 deletions controllers/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,20 @@ func resolveSoleOrg(ctx context.Context, orgID string) (*schema.Organization, er
if err != nil {
return nil, err
}
if orgID != "sole" && orgID != o.ID && orgID != o.Slug {
return nil, errOrgNotFound

if orgID == "sole" {
return o, nil
}

if orgID == o.ID {
return o, nil
}
return o, nil

if orgID == o.Slug {
return o, nil
}

return nil, errOrgNotFound
}

// @Summary Get organization SSO settings
Expand Down
70 changes: 44 additions & 26 deletions controllers/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func authenticateUser(response http.ResponseWriter, request *http.Request) {
return
}

if logic.IsOauthUser(user) == nil {
if logic.IsOauthUser(request.Context(), user) == nil {
logic.ReturnErrorResponse(response, request, logic.FormatError(errors.New("user is registered via SSO"), "badrequest"))
return
}
Expand Down Expand Up @@ -1682,48 +1682,61 @@ func updateUser(w http.ResponseWriter, r *http.Request) {
break
}
}
if !ismaster && selfUpdate {
if user.PlatformRoleID != userchange.PlatformRoleID {
slog.Error("user cannot change his own role", "caller", caller.Username, "attempted to update user role", username)
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("user not allowed to self assign role"), "forbidden"))
return

}
if scope.Level(r.Context()) == scope.TenantScope {
if !ismaster && selfUpdate {
if user.PlatformRoleID != userchange.PlatformRoleID {
slog.Error("user cannot change his own role", "caller", caller.Username, "attempted to update user role", username)
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("user not allowed to self assign role"), "forbidden"))
return

if logic.IsMFAEnforced(r.Context()) && user.IsMFAEnabled && !userchange.IsMFAEnabled {
err = errors.New("mfa is enforced, user cannot unset their own mfa")
slog.Error("failed to update user", "caller", caller.Username, "attempted to update user", username, "error", err)
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "forbidden"))
return
}
}

if servercfg.IsPro && caller.PlatformRoleID != schema.SuperAdminRole {
// users cannot update their own groups; superadmin is exempt
if len(user.UserGroups.Data()) != len(userchange.UserGroups.Data()) || !reflect.DeepEqual(user.UserGroups.Data(), userchange.UserGroups.Data()) {
err = errors.New("user cannot update self update their groups")
if logic.IsMFAEnforced(r.Context()) && user.IsMFAEnabled && !userchange.IsMFAEnabled {
err = errors.New("mfa is enforced, user cannot unset their own mfa")
slog.Error("failed to update user", "caller", caller.Username, "attempted to update user", username, "error", err)
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "forbidden"))
return
}

if servercfg.IsPro && caller.PlatformRoleID != schema.SuperAdminRole {
// users cannot update their own groups; superadmin is exempt
if len(user.UserGroups.Data()) != len(userchange.UserGroups.Data()) || !reflect.DeepEqual(user.UserGroups.Data(), userchange.UserGroups.Data()) {
err = errors.New("user cannot self update their groups")
slog.Error("failed to update user", "caller", caller.Username, "attempted to update user", username, "error", err)
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "forbidden"))
return
}
}
}
}
if ismaster {
if user.PlatformRoleID != schema.SuperAdminRole && userchange.PlatformRoleID == schema.SuperAdminRole {
slog.Error("operation not allowed", "caller", logic.MasterUser, "attempted to update user role to superadmin", username)
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("attempted to update user role to superadmin"), "forbidden"))

if ismaster {
if user.PlatformRoleID != schema.SuperAdminRole && userchange.PlatformRoleID == schema.SuperAdminRole {
slog.Error("operation not allowed", "caller", logic.MasterUser, "attempted to update user role to superadmin", username)
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("attempted to update user role to superadmin"), "forbidden"))
return
}
}

if user.AuthType == schema.Inherited && userchange.Password != "" {
err = fmt.Errorf("cannot update password for user with inherited auth")
logic.ReturnErrorResponse(w, r, logic.FormatError(err, logic.BadReq))
return
}
}
Comment thread
VishalDalwadi marked this conversation as resolved.

if logic.IsOauthUser(user) == nil && userchange.Password != "" {
err := fmt.Errorf("cannot update user's password for an oauth user %s", username)
if logic.IsOauthUser(r.Context(), user) == nil && userchange.Password != "" {
err := fmt.Errorf("cannot update password for an oauth user %s", username)
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "forbidden"))
return
}

var deleteAccessTokens bool
if scope.Level(r.Context()) == scope.TenantScope &&
(userchange.PlatformRoleID != user.PlatformRoleID || !logic.CompareMaps(user.UserGroups.Data(), userchange.UserGroups.Data())) {
(&schema.UserAccessToken{UserName: user.Username}).DeleteAllUserTokens(r.Context())
deleteAccessTokens = true
}

oldUser := *user
if ismaster {
caller = &schema.User{
Expand Down Expand Up @@ -1770,6 +1783,11 @@ func updateUser(w http.ResponseWriter, r *http.Request) {
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
return
}

if deleteAccessTokens {
_ = (&schema.UserAccessToken{UserName: user.Username}).DeleteAllUserTokens(r.Context())
}

logic.LogEvent(r.Context(), &e)
ctx := scope.WithContext(db.WithContext(context.Background()), scope.Level(r.Context()), scope.ID(r.Context()))
go mq.PublishPeerUpdate(ctx, false)
Expand Down Expand Up @@ -1916,7 +1934,7 @@ func deleteUser(w http.ResponseWriter, r *http.Request) {
break
}

if user.AuthType == schema.OAuth || user.ExternalIdentityProviderID != "" {
if logic.IsIDPUser(r.Context(), user) {
err = fmt.Errorf("cannot delete idp user %s", username)
logger.Log(0, username, "failed to delete user: ", err.Error())
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
Expand Down
18 changes: 14 additions & 4 deletions logic/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func ResolveInheritedAuth(ctx context.Context, user *schema.User) error {
}

// IsOauthUser - returns
func IsOauthUser(user *schema.User) error {
var currentValue, err = FetchOAuthSecret()
func IsOauthUser(ctx context.Context, user *schema.User) error {
var currentValue, err = FetchOAuthSecret(ctx)
if err != nil {
return err
}
Expand Down Expand Up @@ -346,6 +346,16 @@ func ValidateUser(user *schema.User) error {
return validationErr
}

func IsIDPUser(ctx context.Context, user *schema.User) bool {
if scope.Level(ctx) == scope.TenantScope {
if user.AuthType == schema.OAuth && IsSyncEnabled(ctx) {
return true
}
}

return false
}
Comment thread
VishalDalwadi marked this conversation as resolved.

// DeleteUser - deletes a given user
func DeleteUser(ctx context.Context, user *schema.User) error {
err := user.DeleteMembership(ctx)
Expand Down Expand Up @@ -383,11 +393,11 @@ func SetOAuthSecret(secret string) error {
}

// FetchOAuthSecret fetches secrets for oauth
func FetchOAuthSecret() (string, error) {
func FetchOAuthSecret(ctx context.Context) (string, error) {
oauthSecret := &schema.Internal{
Key: schema.InternalKey_OAuthSecret,
}
err := oauthSecret.Get(db.WithContext(context.TODO()))
err := oauthSecret.Get(ctx)
if err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions logic/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func applyDeviceNetworkHostState(ctx context.Context, host *schema.Host, network
return
}

violations, _ := CheckPostureViolationsForHost(host, nil, schema.NetworkID(network.Name), true)
violations, _ := CheckPostureViolationsForHost(ctx, host, nil, schema.NetworkID(network.Name), true)
if len(violations) > 0 {
dn.Status = models.DeviceNetworkStatusBlocked
return
Expand Down Expand Up @@ -289,7 +289,7 @@ func JoinDeviceNetwork(ctx context.Context, user *schema.User, host *schema.Host
return models.DeviceJoinResult{Status: models.DeviceJoinStatusJoined}, nil
}

violations, _ := CheckPostureViolationsForHost(host, nil, schema.NetworkID(networkID), true)
violations, _ := CheckPostureViolationsForHost(ctx, host, nil, schema.NetworkID(networkID), true)
if len(violations) > 0 {
return empty, errors.New("access blocked: this device doesn't meet security requirements")
}
Expand Down
7 changes: 3 additions & 4 deletions logic/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,16 @@ var HostLimitExceeded = func(ctx context.Context) bool {
return false
}

// todo(nm-341): add ctx to func
var CheckPostureViolations = func(d models.PostureCheckDeviceInfo, network schema.NetworkID) (v []models.Violation, level schema.Severity) {
var CheckPostureViolations = func(ctx context.Context, d models.PostureCheckDeviceInfo, network schema.NetworkID) (v []models.Violation, level schema.Severity) {
return []models.Violation{}, schema.SeverityUnknown
}

// todo(nm-341): add ctx to func
var CheckPostureViolationsForHost = func(host *schema.Host, tags map[models.TagID]struct{}, network schema.NetworkID, skipAutoUpdate bool) ([]models.Violation, schema.Severity) {
var CheckPostureViolationsForHost = func(ctx context.Context, host *schema.Host, tags map[models.TagID]struct{}, network schema.NetworkID, skipAutoUpdate bool) ([]models.Violation, schema.Severity) {
if host == nil {
return []models.Violation{}, schema.SeverityUnknown
}
return CheckPostureViolations(models.PostureCheckDeviceInfo{
return CheckPostureViolations(ctx, models.PostureCheckDeviceInfo{
ClientLocation: host.CountryCode,
ClientVersion: host.Version,
OS: host.OS,
Expand Down
1 change: 0 additions & 1 deletion logic/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
)

func GetCurrentServerUsage(ctx context.Context) (limits models.Usage) {
// todo(nm-341): get usage of all tenants or specific tenant?
limits.SetDefaults()
hosts, hErr := GetAllHostsWithStatus(ctx, schema.OnlineSt)
if hErr == nil {
Expand Down
2 changes: 1 addition & 1 deletion migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ func syncUsers() {
for _, user := range users {
user := user
user.AuthType = schema.BasicAuth
if logic.IsOauthUser(&user) == nil {
if logic.IsOauthUser(db.WithContext(context.TODO()), &user) == nil {
user.AuthType = schema.OAuth
}

Expand Down
4 changes: 2 additions & 2 deletions orchestrator/extensions/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
)

type UserExtensions interface {
ConfigureAuthType(user *schema.User) error
ConfigureAuthType(ctx context.Context, user *schema.User) error
ConfigureGlobalAdminGroup(membership *schema.TenantMembership)
ConfigureGroups(ctx context.Context, membership *schema.TenantMembership, groups datatypes.JSONType[map[schema.UserGroupID]struct{}])
SendEmailValidation(ctx context.Context, user *schema.User) error
}

type CEUserExtensions struct{}

func (c *CEUserExtensions) ConfigureAuthType(user *schema.User) error {
func (c *CEUserExtensions) ConfigureAuthType(_ context.Context, user *schema.User) error {
user.AuthType = schema.BasicAuth
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions orchestrator/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ func (n *NodeOrchestrator) CreateNode(ctx context.Context, host *schema.Host, ne
}
}

go func() {
go func(ctx context.Context) {
modelsNode := logic.ConvertSchemaNodeToModelsNode(node)

modelsNode.PostureChecksViolations, modelsNode.PostureCheckViolationSeverityLevel = logic.CheckPostureViolations(logic.GetPostureCheckDeviceInfoByNode(modelsNode), schema.NetworkID(node.Network.Name))
modelsNode.PostureChecksViolations, modelsNode.PostureCheckViolationSeverityLevel = logic.CheckPostureViolations(ctx, logic.GetPostureCheckDeviceInfoByNode(modelsNode), schema.NetworkID(node.Network.Name))
node.PostureCheckSeverity = modelsNode.PostureCheckViolationSeverityLevel
node.PostureCheckLastEvaluationCycleID = uuid.NewString()
node.PostureCheckLastEvaluatedAt = time.Now().UTC()
Expand All @@ -175,7 +175,7 @@ func (n *NodeOrchestrator) CreateNode(ctx context.Context, host *schema.Host, ne
EvaluatedAt: node.PostureCheckLastEvaluatedAt,
})
}
err = node.UpsertViolations(db.WithContext(context.TODO()), _violations)
err = node.UpsertViolations(ctx, _violations)
if err != nil {
logger.Log(1, fmt.Sprintf("failed to upsert node (%s) posture check violations: %v", modelsNode.ID, err))
}
Expand Down Expand Up @@ -204,7 +204,7 @@ func (n *NodeOrchestrator) CreateNode(ctx context.Context, host *schema.Host, ne
time.Sleep(time.Second * 30)
logic.TriggerCollectMetrics(host.ID.String(), node.ID, "join")
}
}()
}(scope.WithContext(db.WithContext(context.Background()), scope.Level(ctx), scope.ID(ctx)))

return node, nil
}
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (u *UserOrchestrator) CreateUser(ctx context.Context, user *schema.User, op

user.Password = string(passwordHash)

err = u.userExt.ConfigureAuthType(user)
err = u.userExt.ConfigureAuthType(ctx, user)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pro/auth/azure-ad.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (p *AzureADProvider) HandleCallback(w http.ResponseWriter, r *http.Request)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
if inviteExists {
user, err := proLogic.PrepareOauthUserFromInvite(in)
user, err := proLogic.PrepareOauthUserFromInvite(r.Context(), in)
if err != nil {
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
return
Expand Down Expand Up @@ -179,7 +179,7 @@ func (p *AzureADProvider) HandleCallback(w http.ResponseWriter, r *http.Request)
return
}

newPass, fetchErr := logic.FetchOAuthSecret()
newPass, fetchErr := logic.FetchOAuthSecret(r.Context())
if fetchErr != nil {
return
}
Expand Down
Loading