c25db4e2346ed46b90269dc4b130acf1f786060f
[openafs.git] / src / WINNT / afsclass / c_usr.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef AFSCLASS_USER_H
11 #define AFSCLASS_USER_H
12
13 #include <WINNT/afsclass.h>
14 #include <WINNT/c_svc.h>
15
16
17 /*
18  * USER CLASS _________________________________________________________________
19  *
20  */
21
22 typedef struct USERSTATUS
23    {
24    BOOL fHaveKasInfo;
25    BOOL fHavePtsInfo;
26
27    struct
28       {
29       BOOL fIsAdmin;
30       BOOL fCanGetTickets;
31       BOOL fEncrypt;
32       BOOL fCanChangePassword;
33       BOOL fCanReusePasswords;
34       SYSTEMTIME timeExpires;
35       SYSTEMTIME timeLastPwChange;
36       SYSTEMTIME timeLastMod;
37       LPIDENT lpiLastMod;
38       LONG csecTicketLifetime;
39       int keyVersion;
40       ENCRYPTIONKEY key;
41       DWORD dwKeyChecksum;
42       LONG cdayPwExpire;
43       LONG cFailLogin;
44       LONG csecFailLoginLock;
45       } KASINFO;
46
47    struct
48       {
49       LONG cgroupCreationQuota;
50       LONG cgroupMember;
51       int uidName;
52       int uidOwner;
53       int uidCreator;
54       TCHAR szOwner[ cchNAME ];
55       TCHAR szCreator[ cchNAME ];
56       ACCOUNTACCESS aaListStatus;
57       ACCOUNTACCESS aaGroupsOwned;
58       ACCOUNTACCESS aaMembership;
59       } PTSINFO;
60
61    } USERSTATUS, *LPUSERSTATUS;
62
63
64 class USER
65    {
66    friend class CELL;
67    friend class IDENT;
68    friend class PTSGROUP;
69
70    public:
71       void Close (void);
72       void Invalidate (void);
73       BOOL RefreshStatus (BOOL fNotify = TRUE, ULONG *pStatus = NULL);
74
75       // User properties
76       //
77       LPIDENT GetIdentifier (void);
78       LPCELL OpenCell (ULONG *pStatus = NULL);
79       void GetName (LPTSTR pszPrincipal, LPTSTR pszInstance = NULL);
80
81       BOOL GetStatus (LPUSERSTATUS lpus, BOOL fNotify = TRUE, ULONG *pStatus = NULL);
82
83       PVOID GetUserParam (void);
84       void SetUserParam (PVOID pUserParam);
85
86       // Groups
87       //
88       BOOL GetOwnerOf (LPTSTR *ppmsz, ULONG *pStatus = NULL);
89       BOOL GetMemberOf (LPTSTR *ppmsz, ULONG *pStatus = NULL);
90
91       static void SplitUserName (LPCTSTR pszFull, LPTSTR pszName, LPTSTR pszInstance);
92       static BOOL IsMachineAccount (LPCTSTR pszName);
93
94    private:
95       USER (LPCELL lpCellParent, LPTSTR pszPrincipal, LPTSTR pszInstance);
96       ~USER (void);
97       void SendDeleteNotifications (void);
98
99    private:
100       LPIDENT m_lpiCell;
101       TCHAR m_szPrincipal[ cchNAME ];
102       TCHAR m_szInstance[ cchNAME ];
103
104       LPIDENT m_lpiThis;
105
106       BOOL m_fStatusOutOfDate;
107       USERSTATUS m_us;
108
109       LPTSTR m_mszOwnerOf;
110       LPTSTR m_mszMemberOf;
111    };
112
113
114 #endif  // AFSCLASS_USER_H
115