Greenbone Security Assistant  8.0.0
gsad_user.h
Go to the documentation of this file.
1 /* Copyright (C) 2016-2018 Greenbone Networks GmbH
2  *
3  * SPDX-License-Identifier: GPL-2.0-or-later
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the 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 General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
25 #ifndef _GSAD_USER_H
26 #define _GSAD_USER_H
27 
28 #include "gsad_params.h"
29 
30 #include <glib.h>
31 
32 #define USER_OK 0
33 #define USER_BAD_TOKEN 1
34 #define USER_EXPIRED_TOKEN 2
35 #define USER_BAD_MISSING_COOKIE 3
36 #define USER_BAD_MISSING_TOKEN 4
37 #define USER_GUEST_LOGIN_FAILED 5
38 #define USER_GMP_DOWN 6
39 #define USER_IP_ADDRESS_MISSMATCH 7
40 #define USER_GUEST_LOGIN_ERROR -1
41 
45 typedef struct user user_t;
46 
47 void
49 
50 user_t *
52 
53 int
54 user_find (const gchar *cookie, const gchar *token, const char *address,
55  user_t **user_return);
56 
57 user_t *
58 user_add (const gchar *username, const gchar *password, const gchar *timezone,
59  const gchar *severity, const gchar *role, const gchar *capabilities,
60  const gchar *language, const gchar *pw_warning, const char *address);
61 
62 void
63 user_set_timezone (user_t *user, const gchar *timezone);
64 
65 void
66 user_set_username (user_t *user, const gchar *username);
67 
68 void
69 user_set_password (user_t *user, const gchar *password);
70 
71 void
72 user_set_severity (user_t *user, const gchar *severity);
73 
74 void
75 user_set_language (user_t *user, const gchar *language);
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 gboolean
97 
98 const gchar *
100 
101 const gchar *
103 
104 const gchar *
106 
107 const gchar *
109 
110 const gchar *
112 
113 const time_t
115 
116 int
118 
119 void
121 
122 #endif /* _GSAD_USER_H_ */
const gchar * user_get_role(user_t *user)
Definition: gsad_user.c:211
gchar * pw_warning
Password policy warning.
Definition: gsad_user.c:53
const gchar * user_get_cookie(user_t *user)
Definition: gsad_user.c:169
void user_set_username(user_t *user, const gchar *username)
Set username of user.
Definition: gsad_user.c:311
void user_renew_session(user_t *user)
Definition: gsad_user.c:60
gchar * language
User Interface Language.
Definition: gsad_user.c:52
gchar * capabilities
Capabilities.
Definition: gsad_user.c:51
user_t * user_add(const gchar *username, const gchar *password, const gchar *timezone, const gchar *severity, const gchar *role, const gchar *capabilities, const gchar *language, const gchar *pw_warning, const char *address)
Add a user.
Definition: gsad_user.c:359
const gchar * user_get_username(user_t *user)
Definition: gsad_user.c:157
gchar * severity
Severity class.
Definition: gsad_user.c:50
const gchar * user_get_severity(user_t *user)
Definition: gsad_user.c:205
const gchar * user_get_client_address(user_t *user)
Definition: gsad_user.c:199
gchar * timezone
Timezone.
Definition: gsad_user.c:49
const gchar * user_get_language(user_t *user)
Definition: gsad_user.c:163
Http Parameter handling in GSA.
gchar * token
Request session token.
Definition: gsad_user.c:45
void user_free(user_t *user)
Definition: gsad_user.c:102
int user_logout(user_t *user)
Logout a user.
Definition: gsad_user.c:325
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:411
gchar * cookie
Cookie token.
Definition: gsad_user.c:44
void user_set_language(user_t *user, const gchar *language)
Set language of user.
Definition: gsad_user.c:289
const gchar * user_get_password_warning(user_t *user)
Definition: gsad_user.c:187
gboolean user_get_guest(user_t *user)
Definition: gsad_user.c:223
gchar * username
Login name.
Definition: gsad_user.c:46
const gchar * user_get_capabilities(user_t *user)
Definition: gsad_user.c:181
user_t * user_copy(user_t *user)
Definition: gsad_user.c:124
const gchar * user_get_password(user_t *user)
Definition: gsad_user.c:217
User information structure, for sessions.
Definition: gsad_user.c:42
void user_set_timezone(user_t *user, const gchar *timezone)
Set timezone of user.
Definition: gsad_user.c:242
gchar * password
Password.
Definition: gsad_user.c:47
gchar * role
Role.
Definition: gsad_user.c:48
const time_t user_get_session_timeout(user_t *user)
Definition: gsad_user.c:229
void user_set_severity(user_t *user, const gchar *severity)
Set severity class of user.
Definition: gsad_user.c:274
const gchar * user_get_token(user_t *user)
Definition: gsad_user.c:175
void user_set_password(user_t *user, const gchar *password)
Set password of user.
Definition: gsad_user.c:257
const gchar * user_get_timezone(user_t *user)
Definition: gsad_user.c:193
gchar * address
Client's IP address.
Definition: gsad_user.c:54