public void SetUp() { AuthModule.EnableAuth(); var ownerPermissions = new EtcdPermissions(); ownerPermissions.AddWritePermissions("/fleet/*"); ownerPermissions.AddReadPermissions("/fleet/*"); var writerPermissions = new EtcdPermissions(); writerPermissions.AddWritePermissions("/fleet/*"); var readerPermissions = new EtcdPermissions(); readerPermissions.AddReadPermissions("/fleet/*"); AuthModule.SetRole(new EtcdSetRoleRequest { role = ROLE_WITH_READ_WRITE_PERMISSIONS, permissions = ownerPermissions }); AuthModule.SetRole(new EtcdSetRoleRequest { role = ROLE_WITH_WRITE_PERMISSIONS, permissions = writerPermissions }); AuthModule.SetRole(new EtcdSetRoleRequest { role = ROLE_WITH_READ_PERMISSIONS, permissions = readerPermissions }); }
public void ShouldHandleGrantPermissions() { var permissionsToGrant = new EtcdPermissions(); permissionsToGrant.AddWritePermissions("/bar/*"); AuthModule.SetRole(new EtcdSetRoleRequest { role = ROLE_WITH_READ_WRITE_PERMISSIONS, grant = permissionsToGrant }); var ownerPermissions = AuthModule.GetRoleDetails(ROLE_WITH_READ_WRITE_PERMISSIONS); ownerPermissions.role.ShouldEqual(ROLE_WITH_READ_WRITE_PERMISSIONS); ownerPermissions.permissions.kv.read.ShouldContain("/fleet/*"); ownerPermissions.permissions.kv.write.Count.ShouldEqual(2); ownerPermissions.permissions.kv.write.ShouldContain("/fleet/*"); ownerPermissions.permissions.kv.write.ShouldContain("/bar/*"); }
private void CreateRoles() { var fullPermissions = new EtcdPermissions(); fullPermissions.AddWritePermissions("/a/keys/*"); fullPermissions.AddWritePermissions("/a/b/keys/*"); fullPermissions.AddReadPermissions("/a/keys/*"); fullPermissions.AddReadPermissions("/a/b/keys/*"); var readPermissions = new EtcdPermissions(); readPermissions.AddReadPermissions("/a/keys/*"); readPermissions.AddReadPermissions("/a/b/keys/*"); var writePermissions = new EtcdPermissions(); writePermissions.AddWritePermissions("/a/keys/*"); writePermissions.AddWritePermissions("/a/b/keys/*"); AuthModule.SetRole(new EtcdSetRoleRequest { role = ROLE_WITH_READ_WRITE_PERMISSIONS, permissions = fullPermissions }); AuthModule.SetRole(new EtcdSetRoleRequest { role = ROLE_WITH_WRITE_PERMISSIONS, permissions = writePermissions }); AuthModule.SetRole(new EtcdSetRoleRequest { role = ROLE_WITH_READ_PERMISSIONS, permissions = readPermissions }); }
public void SetUp() { AuthModule.EnableAuth(); var rootPermissions = new EtcdPermissions(); rootPermissions.AddWritePermissions("*"); rootPermissions.AddReadPermissions("*"); CreateRoles(); CreateUsers(); InitEtcdClients(); CreateData(); }