File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed
Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ blaze@2.1.2
2020blaze-tools@1.0.3
2121boilerplate-generator@1.0.3
2222bootstrap@0.3.1
23- brylie:api-umbrella@0.2.2
23+ brylie:api-umbrella@0.2.3
2424callback-hook@1.0.3
2525cfs:access-point@0.1.49
2626cfs:base-package@0.0.30
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ Schemas.UserProfile = new SimpleSchema(
1717 type : String
1818 optional : true
1919
20+ apiKey :
21+ label : ' API key (optional)'
22+ type : String ,
23+ regEx : / ^ [a-z0-9A-Z ] {40} $ / ,
24+ optional : true ,
25+
2026)
2127
2228Schemas .User = new SimpleSchema (
@@ -26,7 +32,10 @@ Schemas.User = new SimpleSchema(
2632 regEx : / ^ [a-z0-9A-Z _] {3,15} $ /
2733 optional : true
2834
29-
35+ apiUmbrellaUserId :
36+ type : String
37+ optional : true
38+
3039 emails :
3140 type : [Object ]
3241 optional : true
Original file line number Diff line number Diff line change @@ -41,4 +41,26 @@ Accounts.onCreateUser (options, user) ->
4141 profilePicture = ProfilePictures .insert picture
4242 user .profile .picture = profilePicture ._id
4343
44+ # apiumbrella user obect to be send to apiUmbrellaWeb
45+ apiUmbrellaUserObj = {
46+ " user" : {
47+ " email" : user .emails [0 ].address ,
48+ " first_name" : " -" ,
49+ " last_name" : " -" ,
50+ " terms_and_conditions" : true
51+ }
52+ }
53+
54+ response = apiUmbrellaWeb .adminApi .v1 .apiUsers .createUser (apiUmbrellaUserObj)
55+
56+ # adding to Aping user object ID of just created apiUmbrella User
57+ user .apiUmbrellaUserId = response .data .user .id
58+
59+ # adding Api key to user profile
60+ # TODO: make apiKey field not editable or display api key on profile page separately from form - as a plain text
61+ user .profile .apiKey = response .data .user .api_key
62+
63+ # adding umbrella user to apinf database
64+ ApiUmbrellaUsers .insert (response .data .user )
65+
4466 user
You can’t perform that action at this time.
0 commit comments