forked from wxygeek/linux-user
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.d.ts
More file actions
115 lines (109 loc) · 2.71 KB
/
Copy pathindex.d.ts
File metadata and controls
115 lines (109 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
export type ErrorType = undefined | string | Error | null;
export interface UserCreationArgs {
username: string;
create_home: boolean;
shell?: string | null;
home_dir?: string;
expiredate?: string | Date;
skel?: string;
system?: boolean;
selinux_user?: boolean;
other_args?: string;
}
export interface UserInfo {
username: string;
password: string;
uid: number;
gid: number;
fullname: string;
homedir: string;
shell: string;
}
export interface GroupInfo {
groupname: string;
password: string;
gid: number;
members: string[];
}
export interface UserExpirationInfo {
changed: Date;
passwordExpires: null | Date;
inactive: null | Date;
accountExpires: null | Date;
minDays: number;
maxDays: number;
warnDays: number;
}
export interface UserExpirationEditArgs {
lastday: Date | string;
expiredate: Date | string;
inactive: Date | string;
minDays: number;
maxDays: number;
warnDays: number;
}
export default class LinuxUser {
static addUser(
args: UserCreationArgs | string,
callback: (error: ErrorType, user?: UserInfo | null) => void
): void;
static removeUser(
username: string,
callback: (error: ErrorType) => void
): void;
static getUserGroups(
username: string,
callback: (error: ErrorType, groups?: string[]) => void
): void;
static getUsers(
callback: (error: ErrorType, users?: UserInfo[]) => void
): void;
static getUserInfo(
username: string,
callback: (error: ErrorType, user?: UserInfo) => void
): void;
static setPassword(
username: string,
password: string,
callback: (error: ErrorType) => void
): void;
static addGroup(
groupName: string,
callback: (error: ErrorType, group?: GroupInfo | null) => void
): void;
static removeGroup(
groupName: string,
callback: (error: ErrorType) => void
): void;
static getGroups(
callback: (error: ErrorType, groups?: GroupInfo[]) => void
): void;
static getGroupInfo(
groupName: string,
callback: (error: ErrorType, group?: GroupInfo | null) => void
): void;
static addUserToGroup(
username: string,
groupName: string,
callback: (error: ErrorType) => void
): void;
static getExpiration(
username: string,
callback: (error: ErrorType, data?: UserExpirationInfo) => void
): void;
static setExpiration(
username: string,
args: UserExpirationEditArgs,
callback: (error: ErrorType, data: any) => void
): void;
static verifySSHKey(
key: string,
callback: (error: ErrorType, done?: boolean) => void
): void;
static addSSHtoUser(
username: string,
key: string,
callback: (error: ErrorType, done?: boolean) => void
): void;
static validateUsername(username: string): boolean;
}