Skip to content

Commit 3058c4b

Browse files
bzbarsky-applewoody-appleandy31415restyled-commits
authored
Generate LockUserChange events when clearing a credential. (project-chip#33797)
* Generate LockUserChange events when clearing a credential. We were passing false for sendUserChangeEvent at all callsites of clearCredential(), which is not correct for the "clear a single credential" case. The other cases generate their own LockUserChange events. * Update src/app/clusters/door-lock-server/door-lock-server.cpp Co-authored-by: Andrei Litvin <andy314@gmail.com> * Restyled by clang-format --------- Co-authored-by: Justin Wood <woody@apple.com> Co-authored-by: Andrei Litvin <andy314@gmail.com> Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 2ee90eb commit 3058c4b

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

scripts/tests/chiptest/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def _GetDarwinFrameworkToolUnsupportedTests() -> Set[str]:
171171
"""Tests that fail in darwin-framework-tool for some reason"""
172172
return {
173173
"DL_LockUnlock", # darwin-framework-tool does not currently support reading or subscribing to Events
174+
"DL_UsersAndCredentials", # darwin-framework-tool does not currently support reading or subscribing to Events
174175
"Test_AddNewFabricFromExistingFabric", # darwin-framework-tool does not support the GetCommissionerRootCertificate command.
175176
# The name of the arguments once converted differs for chip-tool and darwin-framework-tool (attribute-ids vs attribute-id. See #31934)
176177
"TestAttributesById",

src/app/clusters/door-lock-server/door-lock-server.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,8 @@ void DoorLockServer::clearCredentialCommandHandler(
951951
}
952952

953953
commandObj->AddStatus(commandPath,
954-
clearCredential(commandPath.mEndpointId, modifier, sourceNodeId, credentialType, credentialIndex, false));
954+
clearCredential(commandPath.mEndpointId, modifier, sourceNodeId, credentialType, credentialIndex,
955+
/* sendUserChangeEvent = */ true));
955956
}
956957

957958
void DoorLockServer::setWeekDayScheduleCommandHandler(chip::app::CommandHandler * commandObj,

src/app/tests/suites/DL_UsersAndCredentials.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,23 @@ tests:
20512051
- name: "NextUserIndex"
20522052
value: 2
20532053

2054+
- label: "Make sure a LockUserChange event was generated"
2055+
command: "readEvent"
2056+
event: "LockUserChange"
2057+
# I wish there were a way to not hardcode this 25, but it's experimentally
2058+
# determined: doing a read without an eventNumber filter here shows 24
2059+
# LockUserChange events before this removal.
2060+
eventNumber: 25
2061+
response:
2062+
value:
2063+
{
2064+
LockDataType: LockDataTypeEnum.PIN,
2065+
DataOperationType: DataOperationTypeEnum.Clear,
2066+
OperationSource: OperationSourceEnum.Remote,
2067+
UserIndex: 1,
2068+
DataIndex: 1,
2069+
}
2070+
20542071
- label: "Clear the second PIN credential"
20552072
command: "ClearCredential"
20562073
timedInteractionTimeoutMs: 10000

0 commit comments

Comments
 (0)