Skip to content

Commit e997941

Browse files
authored
Merge pull request #95 from xylo/issue-94
add User properties: lastLogin, backend, language, locale, and subAdminGroups
2 parents db8c7e4 + eda4d65 commit e997941

4 files changed

Lines changed: 86 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, locale, and subAdminGroups
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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.aarboard.nextcloud.api.provisioning;
1818

1919
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
20+
import com.fasterxml.jackson.annotation.JsonProperty;
2021

2122
import java.util.List;
2223

@@ -29,6 +30,10 @@ public class User
2930
{
3031
private String id;
3132
private boolean enabled;
33+
private long lastLogin;
34+
private String backend;
35+
@JsonProperty("subadmin")
36+
private List<String> subAdminGroups;
3237
private String email;
3338
private String displayname;
3439
private String phone;
@@ -37,6 +42,8 @@ public class User
3742
private String twitter;
3843
private Quota quota;
3944
private List<String> groups;
45+
private String language;
46+
private String locale;
4047

4148
public String getId() {
4249
return id;
@@ -46,6 +53,23 @@ public boolean isEnabled() {
4653
return enabled;
4754
}
4855

56+
public long getLastLogin() {
57+
return lastLogin;
58+
}
59+
60+
public String getBackend() {
61+
return backend;
62+
}
63+
64+
/**
65+
* Returns the list of groups the user is a sub-admin of.
66+
*
67+
* @return the list of groups the user is a sub-admin of
68+
*/
69+
public List<String> getSubAdminGroups() {
70+
return subAdminGroups;
71+
}
72+
4973
public String getEmail() {
5074
return email;
5175
}
@@ -77,4 +101,12 @@ public Quota getQuota() {
77101
public List<String> getGroups() {
78102
return groups;
79103
}
104+
105+
public String getLanguage() {
106+
return language;
107+
}
108+
109+
public String getLocale() {
110+
return locale;
111+
}
80112
}

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)