Greenbone Security Assistant
gsad_user.h
Go to the documentation of this file.
1 /* Copyright (C) 2016-2021 Greenbone Networks GmbH
2  *
3  * SPDX-License-Identifier: AGPL-3.0-or-later
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as
7  * published by the Free Software Foundation, either version 3 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
24 #ifndef _GSAD_USER_H
25 #define _GSAD_USER_H
26 
27 #include "gsad_params.h"
28 
29 #include <glib.h>
30 
31 #define USER_OK 0
32 #define USER_BAD_TOKEN 1
33 #define USER_EXPIRED_TOKEN 2
34 #define USER_BAD_MISSING_COOKIE 3
35 #define USER_BAD_MISSING_TOKEN 4
36 #define USER_GMP_DOWN 6
37 #define USER_IP_ADDRESS_MISSMATCH 7
38 
42 typedef struct user user_t;
43 
44 void
46 
47 user_t *
49 
50 int
51 user_find (const gchar *cookie, const gchar *token, const char *address,
52  user_t **user_return);
53 
54 user_t *
55 user_add (const gchar *username, const gchar *password, const gchar *timezone,
56  const gchar *role, const gchar *capabilities, const gchar *language,
57  const gchar *pw_warning, const char *address);
58 
59 void
60 user_set_timezone (user_t *user, const gchar *timezone);
61 
62 void
63 user_set_username (user_t *user, const gchar *username);
64 
65 void
66 user_set_password (user_t *user, const gchar *password);
67 
68 void
69 user_set_language (user_t *user, const gchar *language);
70 
71 const gchar *
73 
74 const gchar *
76 
77 const gchar *
79 
80 const gchar *
82 
83 const gchar *
85 
86 const gchar *
88 
89 const gchar *
91 
92 const gchar *
94 
95 const gchar *
97 
98 const gchar *
100 
101 const time_t
103 
104 int
106 
107 void
109 
110 #endif /* _GSAD_USER_H_ */
Http Parameter handling in GSA.
const gchar * user_get_language(user_t *user)
Definition: gsad_user.c:154
const time_t user_get_session_timeout(user_t *user)
Definition: gsad_user.c:208
const gchar * user_get_password_warning(user_t *user)
Definition: gsad_user.c:178
void user_set_username(user_t *user, const gchar *username)
Set username of user.
Definition: gsad_user.c:275
user_t * user_add(const gchar *username, const gchar *password, const gchar *timezone, const gchar *role, const gchar *capabilities, const gchar *language, const gchar *pw_warning, const char *address)
Add a user.
Definition: gsad_user.c:322
user_t * user_copy(user_t *user)
Definition: gsad_user.c:117
const gchar * user_get_cookie(user_t *user)
Definition: gsad_user.c:160
void user_set_password(user_t *user, const gchar *password)
Set password of user.
Definition: gsad_user.c:236
const gchar * user_get_token(user_t *user)
Definition: gsad_user.c:166
void user_set_language(user_t *user, const gchar *language)
Set language of user.
Definition: gsad_user.c:253
void user_free(user_t *user)
Definition: gsad_user.c:96
int user_find(const gchar *cookie, const gchar *token, const char *address, user_t **user_return)
Find a user, given a token and cookie.
Definition: gsad_user.c:361
void user_set_timezone(user_t *user, const gchar *timezone)
Set timezone of user.
Definition: gsad_user.c:221
const gchar * user_get_role(user_t *user)
Definition: gsad_user.c:196
const gchar * user_get_password(user_t *user)
Definition: gsad_user.c:202
const gchar * user_get_username(user_t *user)
Definition: gsad_user.c:148
const gchar * user_get_timezone(user_t *user)
Definition: gsad_user.c:184
void user_renew_session(user_t *user)
Definition: gsad_user.c:57
const gchar * user_get_client_address(user_t *user)
Definition: gsad_user.c:190
int user_logout(user_t *user)
Logout a user.
Definition: gsad_user.c:289
const gchar * user_get_capabilities(user_t *user)
Definition: gsad_user.c:172
User information structure, for sessions.
Definition: gsad_user.c:42
gchar * capabilities
Capabilities.
Definition: gsad_user.c:49
gchar * role
Role.
Definition: gsad_user.c:47
gchar * language
User Interface Language.
Definition: gsad_user.c:50
gchar * token
Request session token.
Definition: gsad_user.c:44
gchar * password
Password.
Definition: gsad_user.c:46
gchar * address
Client's IP address.
Definition: gsad_user.c:52
gchar * username
Login name.
Definition: gsad_user.c:45
gchar * cookie
Cookie token.
Definition: gsad_user.c:43
gchar * timezone
Timezone.
Definition: gsad_user.c:48
gchar * pw_warning
Password policy warning.
Definition: gsad_user.c:51