Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding (Admin) Users via ZeroTier Central API (updateNetwork > permissions map) #25

Open
andreasmarkussen opened this issue Oct 6, 2023 · 1 comment

Comments

@andreasmarkussen
Copy link

I am using the ZeroTier Central API and I can change things like Network Name, Network Description, MTU etc, however I would like to add my colleagues to a network automatically.

I have found the [ZeroTier Central API | ZeroTier Documentation] for updateNetwork (ZeroTier Central API | ZeroTier Documentation 1) and this has a “permissions” property.

However ZT Central or the response does not reflect the changes I make.

Network 885033839019b072 To be updated via url https://api.zerotier.com/api/v1/network/885033839019b072
POST Body to be used

{
  description: 'Dummy Description2',
  config: { name: 'Dummy Name', private: false, mtu: null, tags: [ '' ] },
  permissions: {
    '0501dedc-20da-46e2-8b36-7a46ff75920c': { a: true, d: true, m: true, r: true },
    'eab7efa4-0523-4e38-8f76-f74fde2a5125': { a: true, d: true, m: true, r: true }
  }
}

Network 885033839019b072 updated. Response: 200/OK

{
  id: '885033839019b072',
  type: 'Network',
  clock: 1696332065430,
  config: {
    authTokens: null,
    creationTime: 1694418011397,
    capabilities: [],
    enableBroadcast: true,
    id: '885033839019b072',
    ipAssignmentPools: [ [Object] ],
    lastModified: 1696332065395,
    mtu: 2800,
    multicastLimit: 32,
    name: 'Dummy Name',
    private: false,
    remoteTraceLevel: 0,
    remoteTraceTarget: null,
    routes: [ [Object] ],
    rules: [ [Object] ],
    tags: [ '' ],
    v4AssignMode: { zt: true },
    v6AssignMode: { '6plane': false, rfc4193: false, zt: false },
    dns: { domain: '', servers: null },
    ssoConfig: { enabled: false, mode: '' }
  },
  description: 'Dummy Description2',
  rulesSource: 'accept;',
  permissions: {
    '38852822-5922-4709-8283-5f72f7c2d6d5': { a: true, d: true, m: true, r: true },
    '6ba92a3f-ed27-467a-bf69-52661e93473a': { a: true, d: true, m: true, r: true },
    'eab7efa4-0523-4e38-8f76-f74fde2a5125': { a: true, d: true, m: true, r: true }
  },
  ownerId: 'eab7efa4-0523-4e38-8f76-f74fde2a5125',
  onlineMemberCount: 0,
  authorizedMemberCount: 0,
  totalMemberCount: 0,
  capabilitiesByName: {},
  tagsByName: {},
  ui: {
    membersHelpCollapsed: true,
    rulesHelpCollapsed: true,
    settingsHelpCollapsed: true,
    v4EasyMode: false
  }
}

I would expect that the following user would be added, but it is not added.

'0501dedc-20da-46e2-8b36-7a46ff75920c'

I am able to update networks via the ZeroTier Central UI.

So I wonder - can anyone else make this work?

Br

Andreas

ps. I have also created a post on discuss.zerotier.com but it seemed to be the wrong place to put it?
https://discuss.zerotier.com/t/adding-admin-users-via-zerotier-central-api-updatenetwork-permissions-map/16104

@laduke
Copy link
Contributor

laduke commented Oct 6, 2023

Hello,
It might not be documented, or documented incorrectly. You need to get/post to :
https://api.zerotier.com/api/v1/network/$id/users

Will try to get the docs updated. For now, use the browser's dev tools network tab to see examples of the requests and posts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants