Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for nextcloud api

## Version 14.1.0
- 2025-10-22
- Add User properties: lastLogin, backend, language, locale, and subAdminGroups

## Version 14.0.0
- 2025-10-21
- Bump required java version from 8 to 11+ (Thanks to kindlich)
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/org/aarboard/nextcloud/api/provisioning/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.aarboard.nextcloud.api.provisioning;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

Expand All @@ -29,6 +30,10 @@ public class User
{
private String id;
private boolean enabled;
private long lastLogin;
private String backend;
@JsonProperty("subadmin")
private List<String> subAdminGroups;
private String email;
private String displayname;
private String phone;
Expand All @@ -37,6 +42,8 @@ public class User
private String twitter;
private Quota quota;
private List<String> groups;
private String language;
private String locale;

public String getId() {
return id;
Expand All @@ -46,6 +53,23 @@ public boolean isEnabled() {
return enabled;
}

public long getLastLogin() {
return lastLogin;
}

public String getBackend() {
return backend;
}

/**
* Returns the list of groups the user is a sub-admin of.
*
* @return the list of groups the user is a sub-admin of
*/
public List<String> getSubAdminGroups() {
return subAdminGroups;
}

public String getEmail() {
return email;
}
Expand Down Expand Up @@ -77,4 +101,12 @@ public Quota getQuota() {
public List<String> getGroups() {
return groups;
}

public String getLanguage() {
return language;
}

public String getLocale() {
return locale;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ public enum UserData {
ADDRESS,
WEBSITE,
TWITTER,
PASSWORD
PASSWORD,
LANGUAGE,
LOCALE
}
47 changes: 47 additions & 0 deletions src/test/java/org/aarboard/nextcloud/api/TestUserProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2017 a.schild
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.aarboard.nextcloud.api;

import org.aarboard.nextcloud.api.provisioning.User;
import org.apache.commons.lang3.StringUtils;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;

import static org.junit.Assert.*;

/**
* Tests for the User API.
*
* @author Stefan Endrullis
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestUserProperties extends ATestClass {

@Test
public void t09_01_testGetCurrentUser() {
System.out.println("getCurrentUser");
if (_nc != null) {
User user = _nc.getCurrentUser();
assertNotNull(user);
assertTrue(StringUtils.isNotBlank(user.getId()));
assertTrue(StringUtils.isNotBlank(user.getBackend()));
assertTrue(user.getLastLogin() != 0);
}
}

}