Skip to content

Commit e588267

Browse files
author
Stefan Endrullis
committed
add User properties: lastLogin, backend, language, and locale
1 parent db8c7e4 commit e588267

4 files changed

Lines changed: 74 additions & 1 deletion

File tree

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog for nextcloud api
22

3+
## Version 14.1.0
4+
- 2025-10-22
5+
- Add User properties: lastLogin, backend, language, and locale
6+
37
## Version 14.0.0
48
- 2025-10-21
59
- Bump required java version from 8 to 11+ (Thanks to kindlich)

src/main/java/org/aarboard/nextcloud/api/provisioning/User.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public class User
2929
{
3030
private String id;
3131
private boolean enabled;
32+
private long lastLogin;
33+
private String backend;
3234
private String email;
3335
private String displayname;
3436
private String phone;
@@ -37,6 +39,8 @@ public class User
3739
private String twitter;
3840
private Quota quota;
3941
private List<String> groups;
42+
private String language;
43+
private String locale;
4044

4145
public String getId() {
4246
return id;
@@ -46,6 +50,14 @@ public boolean isEnabled() {
4650
return enabled;
4751
}
4852

53+
public long getLastLogin() {
54+
return lastLogin;
55+
}
56+
57+
public String getBackend() {
58+
return backend;
59+
}
60+
4961
public String getEmail() {
5062
return email;
5163
}
@@ -77,4 +89,12 @@ public Quota getQuota() {
7789
public List<String> getGroups() {
7890
return groups;
7991
}
92+
93+
public String getLanguage() {
94+
return language;
95+
}
96+
97+
public String getLocale() {
98+
return locale;
99+
}
80100
}

src/main/java/org/aarboard/nextcloud/api/provisioning/UserData.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ public enum UserData {
88
ADDRESS,
99
WEBSITE,
1010
TWITTER,
11-
PASSWORD
11+
PASSWORD,
12+
LANGUAGE,
13+
LOCALE
1214
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (C) 2017 a.schild
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
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+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
package org.aarboard.nextcloud.api;
18+
19+
import org.aarboard.nextcloud.api.provisioning.User;
20+
import org.apache.commons.lang3.StringUtils;
21+
import org.junit.FixMethodOrder;
22+
import org.junit.Test;
23+
import org.junit.runners.MethodSorters;
24+
25+
import static org.junit.Assert.*;
26+
27+
/**
28+
* Tests for the User API.
29+
*
30+
* @author Stefan Endrullis
31+
*/
32+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
33+
public class TestUserProperties extends ATestClass {
34+
35+
@Test
36+
public void t09_01_testGetCurrentUser() {
37+
System.out.println("getCurrentUser");
38+
if (_nc != null) {
39+
User user = _nc.getCurrentUser();
40+
assertNotNull(user);
41+
assertTrue(StringUtils.isNotBlank(user.getId()));
42+
assertTrue(StringUtils.isNotBlank(user.getBackend()));
43+
assertTrue(user.getLastLogin() != 0);
44+
}
45+
}
46+
47+
}

0 commit comments

Comments
 (0)