040932c1df29d33c5b196ead00d5ab9c900cd784
[citadel.git] / citadel / user_ops.h
1 /* 
2  * Header file for server functions which perform operations on user objects.
3  *
4  * Copyright (c) 1987-2019 by the citadel.org team
5  *
6  * This program is open source software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License, version 3.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #ifndef __USER_OPS_H__
16 #define __USER_OPS_H__
17
18 #include <ctype.h>
19 #include <syslog.h>
20
21 int hash (char *str);
22 int is_aide (void);
23 int is_room_aide (void);
24 int CtdlCheckInternetMailPermission(struct ctdluser *who);
25 void rebuild_usersbynumber(void);
26 void session_startup (void);
27 void logged_in_response(void);
28 int purge_user (char *pname);
29 int getuserbyuid(struct ctdluser *usbuf, uid_t number);
30
31 int create_user(char *newusername, int become_user, uid_t uid);
32 enum {
33         CREATE_USER_DO_NOT_BECOME_USER,
34         CREATE_USER_BECOME_USER
35 };
36 #define NATIVE_AUTH_UID (-1)
37
38 void do_login(void);
39 int CtdlInvtKick(char *iuser, int op);
40 void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data), void *in_data);
41 void ListThisUser(struct ctdluser *usbuf, void *data);
42 int NewMailCount(void);
43 int InitialMailCheck(void);
44 void put_visit(visit *newvisit);
45 /* MailboxName is deprecated us CtdlMailboxName instead */
46 void MailboxName(char *buf, size_t n, const struct ctdluser *who,
47                  const char *prefix) __attribute__ ((deprecated));
48 int GenerateRelationshipIndex(  char *IndexBuf,
49                                 long RoomID,
50                                 long RoomGen,
51                                 long UserID);
52 int CtdlAssociateSystemUser(char *screenname, char *loginname);
53
54
55
56
57 void CtdlSetPassword(char *new_pw);
58
59 int CtdlForgetThisRoom(void);
60
61 void cmd_newu (char *cmdbuf);
62 void start_chkpwd_daemon(void);
63
64
65 #define RENAMEUSER_OK                   0       /* Operation succeeded */
66 #define RENAMEUSER_LOGGED_IN            1       /* Cannot rename a user who is currently logged in */
67 #define RENAMEUSER_NOT_FOUND            2       /* The old user name does not exist */
68 #define RENAMEUSER_ALREADY_EXISTS       3       /* An account with the desired new name already exists */
69
70 int rename_user(char *oldname, char *newname);
71
72 long cutusername(char *username);
73 void makeuserkey(char *key, const char *username, long len);
74 int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid);
75
76 #endif