ZeroTierOne icon indicating copy to clipboard operation
ZeroTierOne copied to clipboard

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

Open andreasmarkussen opened this issue 2 years ago • 0 comments

Introduction

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.

Detailed Bug Report

What you expect to be happening.

I expect that I can update the Network (Admins) Permissions Maps, as specified in the UpdateNetwork documentation on the ZeroTier Central API Documentation. I would then expect that the UI and the API reflects my changes to the Permissions Map.

What is actually happening?

I get a positive response from the API (response code 200), but the request body does not reflect my changes. The UI or API does not reflect my changes.

Any steps to reproduce the error.

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 }
  }
}
  • Any relevant console output or screenshots. 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
  }
}

What operating system and ZeroTier version. Please try the latest ZeroTier release.

OS: Debian This was tested using NodeJS v18, using axios

andreasmarkussen avatar Oct 06 '23 08:10 andreasmarkussen