Example #1
0
 public ActionResult <bool> Delete(string collectionName)
 {
     return(WrapWithAuthorizationCheck(() =>
     {
         bool deleted = TweezersSchemaFactory.DeleteObject(collectionName);
         IdentityManager.DeletePermission(collectionName);
         SchemaManagement.RemoveObjectReference(collectionName);
         return TweezersOk();
     }, "Delete", DefaultPermission.Edit, TweezersSchemaKey));
 }
Example #2
0
 public ActionResult <TweezersObject> Post([FromBody] TweezersObject data)
 {
     return(WrapWithAuthorizationCheck(() =>
     {
         try
         {
             TweezersObject obj = ReplaceTweezersObject(data);
             IdentityManager.AppendNewPermission(obj);
             SchemaManagement.AddObjectReference(obj.CollectionName);
             return TweezersCreated(obj);
         }
         catch (TweezersValidationException e)
         {
             return TweezersBadRequest(e.Message);
         }
     }, "Post", DefaultPermission.Edit, TweezersSchemaKey));
 }