Skip to content

Commit 4ce3487

Browse files
committed
Added support for user_failed_login system hook event (#334).
1 parent 63587b4 commit 4ce3487

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/main/java/org/gitlab4j/api/systemhooks/SystemHookEvent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
@JsonSubTypes.Type(value = RemoveTeamMemberSystemHookEvent.class, name = TeamMemberSystemHookEvent.TEAM_MEMBER_REMOVED_EVENT),
1717
@JsonSubTypes.Type(value = CreateUserSystemHookEvent.class, name = UserSystemHookEvent.USER_CREATE_EVENT),
1818
@JsonSubTypes.Type(value = DestroyUserSystemHookEvent.class, name = UserSystemHookEvent.USER_DESTROY_EVENT),
19+
@JsonSubTypes.Type(value = UserFailedLoginSystemHookEvent.class, name = UserSystemHookEvent.USER_FAILED_LOGIN_EVENT),
1920
@JsonSubTypes.Type(value = RenameUserSystemHookEvent.class, name = UserSystemHookEvent.USER_RENAME_EVENT),
2021
@JsonSubTypes.Type(value = CreateKeySystemHookEvent.class, name = KeySystemHookEvent.KEY_CREATE_EVENT),
2122
@JsonSubTypes.Type(value = DestroyKeySystemHookEvent.class, name = KeySystemHookEvent.KEY_DESTROY_EVENT),
@@ -54,6 +55,7 @@ class RemoveTeamMemberSystemHookEvent extends TeamMemberSystemHookEvent {}
5455
class CreateUserSystemHookEvent extends UserSystemHookEvent {}
5556
class DestroyUserSystemHookEvent extends UserSystemHookEvent {}
5657
class RenameUserSystemHookEvent extends UserSystemHookEvent {}
58+
class UserFailedLoginSystemHookEvent extends UserSystemHookEvent {}
5759

5860
class CreateKeySystemHookEvent extends KeySystemHookEvent {}
5961
class DestroyKeySystemHookEvent extends KeySystemHookEvent {}

src/main/java/org/gitlab4j/api/systemhooks/UserSystemHookEvent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class UserSystemHookEvent extends AbstractSystemHookEvent {
99
public static final String USER_CREATE_EVENT = "user_create";
1010
public static final String USER_DESTROY_EVENT = "user_destroy";
1111
public static final String USER_RENAME_EVENT = "user_rename";
12+
public static final String USER_FAILED_LOGIN_EVENT = "user_failed_login";
1213

1314
private String eventName;
1415
private Date createdAt;
@@ -18,6 +19,7 @@ public class UserSystemHookEvent extends AbstractSystemHookEvent {
1819
private String username;
1920
private Integer userId;
2021
private String oldUsername;
22+
private String state;
2123

2224
public String getEventName() {
2325
return this.eventName;
@@ -83,6 +85,14 @@ public void setOldUsername(String oldUsername) {
8385
this.oldUsername = oldUsername;
8486
}
8587

88+
public String getState() {
89+
return state;
90+
}
91+
92+
public void setState(String state) {
93+
this.state = state;
94+
}
95+
8696
@Override
8797
public String toString() {
8898
return (JacksonJson.toJsonString(this));

src/test/java/org/gitlab4j/api/TestGitLabApiEvents.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ public void testPolymorphicEvent() throws Exception {
175175
assertTrue(compareJson(event, "wiki-page-event.json"));
176176
}
177177

178-
179178
@Test
180179
public void testProjectSystemHookEvent() throws Exception {
181180
ProjectSystemHookEvent event = unmarshalResource(ProjectSystemHookEvent.class,
@@ -202,6 +201,13 @@ public void testUserSystemHookEvent() throws Exception {
202201
assertTrue(compareJson(event, "user-system-hook-event.json"));
203202
}
204203

204+
@Test
205+
public void testUserFailedLoginSystemHookEvent() throws Exception {
206+
207+
SystemHookEvent event = unmarshalResource(SystemHookEvent.class, "user-failed-login-system-hook-event.json");
208+
assertTrue(compareJson(event, "user-failed-login-system-hook-event.json"));
209+
}
210+
205211
@Test
206212
public void testGroupSystemHookEvent() throws Exception {
207213
SystemHookEvent event = unmarshalResource(SystemHookEvent.class, "group-system-hook-event.json");
@@ -250,6 +256,9 @@ public void testPolymorphicSystemHookEvent() throws Exception {
250256
event = unmarshalResource(SystemHookEvent.class, "user-system-hook-event.json");
251257
assertTrue(compareJson(event, "user-system-hook-event.json"));
252258

259+
event = unmarshalResource(SystemHookEvent.class, "user-failed-login-system-hook-event.json");
260+
assertTrue(compareJson(event, "user-failed-login-system-hook-event.json"));
261+
253262
event = unmarshalResource(SystemHookEvent.class, "group-system-hook-event.json");
254263
assertTrue(compareJson(event, "group-system-hook-event.json"));
255264

0 commit comments

Comments
 (0)