express-user
Advanced tools
Comparing version 0.0.1-alpha.11 to 0.0.1-alpha.12
@@ -181,2 +181,44 @@ //Copyright (c) 2015 Eric Vallee <eric_vallee2003@yahoo.ca> | ||
MainRoutes['UserMembershipsPUT'] = function(UserStore) { | ||
return(function(Req, Res, Next) { | ||
GetRoutingVars(Req, Res, Next, function(RoutingVars) { | ||
UserStore.AddMembership(RoutingVars['User'], RoutingVars['Membership'], function(Err, Result) { | ||
if(Err) | ||
{ | ||
Next(Err); | ||
} | ||
else if(Result==0) | ||
{ | ||
Res.status(400).end(); | ||
} | ||
else | ||
{ | ||
Res.status(204).end(); | ||
} | ||
}); | ||
}); | ||
}); | ||
}; | ||
MainRoutes['UserMembershipsDELETE'] = function(UserStore) { | ||
return(function(Req, Res, Next) { | ||
GetRoutingVars(Req, Res, Next, function(RoutingVars) { | ||
UserStore.RemoveMembership(RoutingVars['User'], RoutingVars['Membership'], function(Err, Result) { | ||
if(Err) | ||
{ | ||
Next(Err); | ||
} | ||
else if(Result==0) | ||
{ | ||
Res.status(400).end(); | ||
} | ||
else | ||
{ | ||
Res.status(204).end(); | ||
} | ||
}); | ||
}); | ||
}); | ||
}; | ||
function ExpressUser(UserStore, Options, Callback) | ||
@@ -217,2 +259,3 @@ { | ||
Router.patch('/User/:Field/:ID', AccessControl.AuthenticateRoute(Roles['Edit'])); | ||
Router.put('/User/:Field/:ID/Memberships/:Membership', AccessControl.AuthenticateRoute(Roles['Edit'])); | ||
} | ||
@@ -223,2 +266,3 @@ | ||
Router.delete('/User/:Field/:ID', AccessControl.AuthenticateRoute(Roles['Delete'])); | ||
Router.delete('/User/:Field/:ID/Memberships/:Membership', AccessControl.AuthenticateRoute(Roles['Delete'])); | ||
} | ||
@@ -242,5 +286,9 @@ | ||
Router.put('/User/Self/Memberships/:Membership', MainRoutes.UserMembershipsPUT(UserStore)); | ||
Router.delete('/User/Self/Memberships/:Membership', MainRoutes.UserMembershipsDELETE(UserStore)); | ||
if(Roles&&Roles.Edit) | ||
{ | ||
Router.patch('/User/:Field/:ID', MainRoutes.UserPATCH(UserStore)); | ||
Router.put('/User/:Field/:ID/Memberships/:Membership', MainRoutes.UserMembershipsPUT(UserStore)); | ||
} | ||
@@ -251,2 +299,3 @@ | ||
Router.delete('/User/:Field/:ID', MainRoutes.UserDELETE(UserStore)); | ||
Router.delete('/User/:Field/:ID/Memberships/:Membership', MainRoutes.UserMembershipsDELETE(UserStore)); | ||
} | ||
@@ -253,0 +302,0 @@ |
{ | ||
"name": "express-user", | ||
"version": "0.0.1-alpha.11", | ||
"version": "0.0.1-alpha.12", | ||
"description": "Ressource Oriented Express Middleware to Manage Users.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -33,2 +33,4 @@ Express-User | ||
- GET /Users/:Field/:ID/Count -> Fetching the count of users with the given value for the given field | ||
- PUT /User/Self/Memberships/:Membership -> Adds Membership to the list of an account's memberships (using session to identify the account) | ||
- DELETE /User/Self/Memberships/:Membership -> Remove Membership to the list of an account's memberships (using session to identify the account) | ||
@@ -39,2 +41,4 @@ 2) Admin URLs: | ||
- GET /User/:Field/:ID -> Fetching account info (using the ID of the given Field to identify the account) | ||
- PUT /User/:Field/:ID/Memberships/:Membership -> Adds Membership to the list of an account's memberships (using the ID of the given Field to identify the account) | ||
- DELETE /User/:Field/:ID/Memberships/:Membership -> Remove Membership to the list of an account's memberships (using the ID of the given Field to identify the account) | ||
@@ -85,2 +89,4 @@ Architecture | ||
Finally, the validator should be very selective about what values of Membership it allows for the /User/Self/Memberships/:Membership routes. | ||
Session Synchronization | ||
@@ -248,1 +254,6 @@ ======================= | ||
- Removed dev dependencies tied to the example | ||
0.0.1-alpha.12 | ||
-------------- | ||
- Added support for membership manipulation routes |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69415
320
256