Add UserPasswordExpired for local users
Adds a new UserPasswordExpired property to local User.Attributes which
represents if the account's password is expired and must be changed.
The value corresponds to the `chage` command.
Note this is distinct from UserLockedForFailedAttempt which represents
a locked account due to unsuccessful authentication atttempts.
Tested: Via busctl
- Checked local and LDAP users.
- Expired password via `passwd --expire USER`.
- Aged password via `chage USER`.
- Changed password via REST API and via the `passwd USER` command.
Signed-off-by: Joseph Reynolds <joseph-reynolds@charter.net>
Change-Id: I44585559509a422bb91c83a2a853c1a033594350
diff --git a/test/mock_user_mgr.hpp b/test/mock_user_mgr.hpp
index 81f9065..ea7c5f6 100644
--- a/test/mock_user_mgr.hpp
+++ b/test/mock_user_mgr.hpp
@@ -19,6 +19,7 @@
MOCK_METHOD1(getLdapGroupName, std::string(const std::string& userName));
MOCK_METHOD0(getPrivilegeMapperObject, DbusUserObj());
MOCK_METHOD1(userLockedForFailedAttempt, bool(const std::string& userName));
+ MOCK_METHOD1(userPasswordExpired, bool(const std::string& userName));
friend class TestUserMgr;
};
diff --git a/test/user_mgr_test.cpp b/test/user_mgr_test.cpp
index 943f0a8..83ae651 100644
--- a/test/user_mgr_test.cpp
+++ b/test/user_mgr_test.cpp
@@ -103,6 +103,7 @@
std::get<std::vector<std::string>>(userInfo["UserGroups"]));
EXPECT_EQ(true, std::get<bool>(userInfo["UserEnabled"]));
EXPECT_EQ(false, std::get<bool>(userInfo["UserLockedForFailedAttempt"]));
+ EXPECT_EQ(false, std::get<bool>(userInfo["UserPasswordExpired"]));
EXPECT_EQ(false, std::get<bool>(userInfo["RemoteUser"]));
}