@timelab/team-service
Service for teams
Last updated 2 years ago by npm-timelab .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @timelab/team-service 
SYNC missed versions from official npm registry.

gRPC team-service

A simple gRPC team-service.

VERSIONS

Installation

$ npm install

Tested with

  • cassandra v3.0.10
  • node v8.1.2
  • npm v5.0.3

ENV

$ export CASSANDRA_HOSTS="cs01"
$ export CASSANDRA_KEYSPACE="timelab"
$ export GRPC_PORT="55002"

start

$ npm start

test

$ npm test

Definition

See team-service.proto for team-service definition.

See team.proto for full definition.

Team object & Role

Example GetPermissionsByUserIdRequest proto.

message GetPermissionsByUserIdRequest {
  string userId = 1;
  repeated Role roleFilters = 2; // optional - if null -> all
}

message GetPermissionsByUserIdResponse {
  Error error = 1;
  UserPermissionList permissionList = 2;
}

Example Role definition.

enum Role {
  MEMBER = 0;
  ADMIN = 1;
  OWNER = 2;
}

Methods

getPermission

Get permission.

client.getPermission({
  userId: '551af6cb-2db6-4288-a9cd-7ea3572c4c66',
  team: 'homepulse'
});

getPermissionsByUserId

Get permissions by user id.

client.getPermissionsByUserId({
  userId: '551af6cb-2db6-4288-a9cd-7ea3572c4c66',
  roleFilters: [ 'OWNER' ] // Optional role filter
});

getPermissionsByTeamName

Get permissions by team name.

client.getPermissionsByTeamName({
  team: 'homepulse',
  roleFilters: [ 'OWNER' ]
});

grant

Set grant for a userId and a team name.

client.grant({
  permission: {
    userId: '551af6cb-2db6-4288-a9cd-7ea3572c4c66',
    team: 'homepulse',
    role: 'OWNER'
  }
});

getUserInfoById

Get info for a user by id.

client.getUserInfoById({ id: '551af6cb-2db6-4288-a9cd-7ea3572c4c66' });

getUserInfoByEmail

Get info for a user by email.

client.getUserInfoByEmail({ email: 'test@test.com' });

getTeamInfo

Get info for a user.

client.getTeamInfo({ team: 'homepulse' });

createTeam

Create a team.

client.createTeam({
  userId: '551af6cb-2db6-4288-a9cd-7ea3572c4c66',
  team: 'homepulse'
});

removeUserFromTeam

Remove a user from a team.

client.removeUserFromTeam({
  userId: '551af6cb-2db6-4288-a9cd-7ea3572c4c66',
  team: 'homepulse'
});

isValidTeamName

Check if a team name is valid.

client.isValidTeamName({ team: 'homepulse' });

TODO

  • Add tests.
  • Improve documentation.

Current Tags

  • 3.3.16                                ...           latest (2 years ago)

53 Versions

  • 3.3.16                                ...           2 years ago
  • 3.3.12                                ...           2 years ago
  • 3.3.9                                ...           2 years ago
  • 3.3.7                                ...           2 years ago
  • 3.3.4                                ...           2 years ago
  • 3.3.2                                ...           2 years ago
  • 3.3.0                                ...           2 years ago
  • 3.2.0                                ...           2 years ago
  • 3.1.15                                ...           2 years ago
  • 3.1.14                                ...           2 years ago
  • 3.1.13                                ...           2 years ago
  • 3.1.12                                ...           2 years ago
  • 3.1.11                                ...           2 years ago
  • 3.1.9                                ...           2 years ago
  • 3.1.8                                ...           2 years ago
  • 3.1.7                                ...           2 years ago
  • 3.1.6                                ...           2 years ago
  • 3.1.5                                ...           2 years ago
  • 3.1.4                                ...           2 years ago
  • 3.1.2                                ...           2 years ago
  • 3.1.0                                ...           2 years ago
  • 3.0.26                                ...           2 years ago
  • 3.0.25                                ...           2 years ago
  • 3.0.24                                ...           2 years ago
  • 3.0.23                                ...           2 years ago
  • 3.0.17                                ...           2 years ago
  • 3.0.12                                ...           2 years ago
  • 3.0.5                                ...           2 years ago
  • 3.0.4                                ...           2 years ago
  • 3.0.2                                ...           3 years ago
  • 3.0.1                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.1.7                                ...           3 years ago
  • 2.1.6                                ...           3 years ago
  • 2.1.5                                ...           3 years ago
  • 2.1.4                                ...           3 years ago
  • 2.1.3                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.3                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.9                                ...           3 years ago
  • 1.0.8                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.6-BETA.1                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.0                                ...           4 years ago

Copyright 2014 - 2016 © taobao.org |