taskrambler  0.1.9
Web server and task management solution.
create_user.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include "class.h"
#include "auth.h"
#include "user.h"
#include "uuid.h"
#include "storage/storage.h"
#include "application/application.h"
#include "interface/serializable.h"
#include "interface/indexable.h"
#include "utils/memory.h"
#include "commons.h"
+ Include dependency graph for create_user.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 

Functions

Uuid applicationCreateUser (Application this, Credential cred, User user)
 

Detailed Description

Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file create_user.c.

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 23 of file create_user.c.

Function Documentation

Uuid applicationCreateUser ( Application  this,
Credential  cred,
User  user 
)
Todo:
error handling is missing here

Definition at line 43 of file create_user.c.

References applicationUpdatePassword(), indexUuid(), MEM_FREE, serialize(), SPR_OK, storageDelete(), storagePut(), and uuidZero.

Referenced by controllerSignupCreate(), and controllerUserCreate().

47 {
48  char * user_serialized;
49  size_t nuser_serialized;
50  Uuid index;
51 
52  index = indexUuid(user, this->user_namespace);
53  serialize(user, (unsigned char **)&user_serialized, &nuser_serialized);
54 
55  if (SPR_OK != storagePut(
56  this->users,
57  (char *)(index->uuid).value,
58  sizeof((index->uuid).value),
59  user_serialized,
60  nuser_serialized))
61  {
62  return uuidZero;
63  }
64 
65  MEM_FREE(user_serialized);
66 
67  if (! applicationUpdatePassword(this, cred, user)) {
68  /**
69  * \todo
70  * error handling is missing here
71  */
73  this->users,
74  (char *)(index->uuid).value,
75  sizeof((index->uuid).value));
76 
77  return uuidZero;
78  }
79 
80  return index;
81 }
#define MEM_FREE(seg)
Definition: memory.h:28
int storageDelete(Storage, char *, size_t)
int applicationUpdatePassword(Application, Credential, User)
StoragePutResult storagePut(Storage, char *, size_t, char *, size_t)
Definition: storage/put.c:34
Uuid uuidZero
void serialize(void *, unsigned char **, size_t *)
Definition: serializable.c:32
Uuid indexUuid(void *, Uuid)
Definition: indexable.c:33

+ Here is the call graph for this function:

+ Here is the caller graph for this function: