Skip to content

Commit c6e1bbc

Browse files
committed
remove unused user functions
1 parent 3c8251c commit c6e1bbc

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

src/Utility/TeeJee.System.vala

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -65,71 +65,11 @@ namespace TeeJee.System{
6565
return euid;
6666
}
6767

68-
public string get_username(){
69-
70-
// returns actual username of current user (even for applications executed with sudo and pkexec)
71-
72-
return get_username_from_uid(get_user_id());
73-
}
74-
75-
public string get_username_effective(){
76-
77-
// returns effective user id ('root' for applications executed with sudo and pkexec)
78-
79-
return get_username_from_uid(get_user_id_effective());
80-
}
81-
82-
public int get_user_id_from_username(string username){
83-
84-
// check local user accounts in /etc/passwd -------------------
85-
86-
foreach(var line in file_read("/etc/passwd").split("\n")){
87-
88-
var arr = line.split(":");
89-
90-
if ((arr.length >= 3) && (arr[0] == username)){
91-
92-
return int.parse(arr[2]);
93-
}
94-
}
95-
96-
// not found --------------------
97-
98-
log_error("UserId not found for userName: %s".printf(username));
99-
100-
return -1;
101-
}
102-
10368
public string? get_username_from_uid(int user_id){
10469
unowned Posix.Passwd? pw = Posix.getpwuid(user_id);
10570
return pw?.pw_name;
10671
}
10772

108-
public string get_user_home(string username = get_username()){
109-
110-
// check local user accounts in /etc/passwd -------------------
111-
112-
foreach(var line in file_read("/etc/passwd").split("\n")){
113-
114-
var arr = line.split(":");
115-
116-
if ((arr.length >= 6) && (arr[0] == username)){
117-
118-
return arr[5];
119-
}
120-
}
121-
122-
// not found --------------------
123-
124-
log_error("Home directory not found for user: %s".printf(username));
125-
126-
return "";
127-
}
128-
129-
public string get_user_home_effective(){
130-
return get_user_home(get_username_effective());
131-
}
132-
13373
// system ------------------------------------
13474

13575
public double get_system_uptime_seconds(){

0 commit comments

Comments
 (0)