Skip to content

Commit 4ffaeab

Browse files
committed
domain sync
1 parent c7b1ce2 commit 4ffaeab

File tree

4 files changed

+193
-4
lines changed

4 files changed

+193
-4
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
/*
2+
* Copyright (c) 2024, FusionAuth, All Rights Reserved
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an
12+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
* either express or implied. See the License for the specific
14+
* language governing permissions and limitations under the License.
15+
*/
16+
package io.fusionauth.domain;
17+
18+
import java.util.Objects;
19+
20+
/**
21+
* Theme object for values used in the css variables for simple themes.
22+
*
23+
* @author Lyle Schemmerling
24+
*/
25+
public class SimpleThemeVariables implements Buildable<SimpleThemeVariables> {
26+
public String alertBackgroundColor;
27+
28+
public String alertFontColor;
29+
30+
public String backgroundImageUrl;
31+
32+
public String backgroundSize;
33+
34+
public String borderRadius;
35+
36+
public String deleteButtonColor;
37+
38+
public String deleteButtonFocusColor;
39+
40+
public String deleteButtonTextColor;
41+
42+
public String deleteButtonTextFocusColor;
43+
44+
public String errorFontColor;
45+
46+
public String errorIconColor;
47+
48+
public String fontColor;
49+
50+
public String fontFamily;
51+
52+
public boolean footerDisplay;
53+
54+
public String iconBackgroundColor;
55+
56+
public String iconColor;
57+
58+
public String infoIconColor;
59+
60+
public String inputBackgroundColor;
61+
62+
public String inputIconColor;
63+
64+
public String inputTextColor;
65+
66+
public String linkTextColor;
67+
68+
public String linkTextFocusColor;
69+
70+
public String logoImageSize;
71+
72+
public String logoImageUrl;
73+
74+
public String monoFontColor;
75+
76+
public String monoFontFamily;
77+
78+
public String pageBackgroundColor;
79+
80+
public String panelBackgroundColor;
81+
82+
public String primaryButtonColor;
83+
84+
public String primaryButtonFocusColor;
85+
86+
public String primaryButtonTextColor;
87+
88+
public String primaryButtonTextFocusColor;
89+
90+
@Override
91+
public boolean equals(Object o) {
92+
if (this == o) {
93+
return true;
94+
}
95+
if (o == null || getClass() != o.getClass()) {
96+
return false;
97+
}
98+
SimpleThemeVariables that = (SimpleThemeVariables) o;
99+
return Objects.equals(alertBackgroundColor, that.alertBackgroundColor) &&
100+
Objects.equals(alertFontColor, that.alertFontColor) &&
101+
Objects.equals(backgroundImageUrl, that.backgroundImageUrl) &&
102+
Objects.equals(backgroundSize, that.backgroundSize) &&
103+
Objects.equals(borderRadius, that.borderRadius) &&
104+
Objects.equals(deleteButtonColor, that.deleteButtonColor) &&
105+
Objects.equals(deleteButtonTextColor, that.deleteButtonTextColor) &&
106+
Objects.equals(deleteButtonTextFocusColor, that.deleteButtonTextFocusColor) &&
107+
Objects.equals(deleteButtonFocusColor, that.deleteButtonFocusColor) &&
108+
Objects.equals(errorFontColor, that.errorFontColor) &&
109+
Objects.equals(errorIconColor, that.errorIconColor) &&
110+
Objects.equals(fontColor, that.fontColor) &&
111+
Objects.equals(fontFamily, that.fontFamily) &&
112+
Objects.equals(footerDisplay, that.footerDisplay) &&
113+
Objects.equals(iconBackgroundColor, that.iconBackgroundColor) &&
114+
Objects.equals(iconColor, that.iconColor) &&
115+
Objects.equals(infoIconColor, that.infoIconColor) &&
116+
Objects.equals(inputBackgroundColor, that.inputBackgroundColor) &&
117+
Objects.equals(inputIconColor, that.inputIconColor) &&
118+
Objects.equals(inputTextColor, that.inputTextColor) &&
119+
Objects.equals(linkTextColor, that.linkTextColor) &&
120+
Objects.equals(linkTextFocusColor, that.linkTextFocusColor) &&
121+
Objects.equals(logoImageSize, that.logoImageSize) &&
122+
Objects.equals(logoImageUrl, that.logoImageUrl) &&
123+
Objects.equals(monoFontColor, that.monoFontColor) &&
124+
Objects.equals(monoFontFamily, that.monoFontFamily) &&
125+
Objects.equals(pageBackgroundColor, that.pageBackgroundColor) &&
126+
Objects.equals(panelBackgroundColor, that.panelBackgroundColor) &&
127+
Objects.equals(primaryButtonColor, that.primaryButtonColor) &&
128+
Objects.equals(primaryButtonFocusColor, that.primaryButtonFocusColor) &&
129+
Objects.equals(primaryButtonTextColor, that.primaryButtonTextColor) &&
130+
Objects.equals(primaryButtonTextFocusColor, that.primaryButtonTextFocusColor);
131+
}
132+
133+
@Override
134+
public int hashCode() {
135+
return Objects.hash(alertBackgroundColor, alertFontColor, backgroundImageUrl, backgroundSize, borderRadius, deleteButtonColor,
136+
deleteButtonTextColor, deleteButtonTextFocusColor, deleteButtonFocusColor, errorFontColor, errorIconColor, fontColor, fontFamily,
137+
footerDisplay, iconBackgroundColor, iconColor, infoIconColor, inputBackgroundColor, inputIconColor, inputTextColor, linkTextColor,
138+
linkTextFocusColor, logoImageSize, logoImageUrl, monoFontColor, monoFontFamily, pageBackgroundColor,
139+
panelBackgroundColor, primaryButtonColor, primaryButtonFocusColor, primaryButtonTextColor, primaryButtonTextFocusColor);
140+
}
141+
}

src/main/java/io/fusionauth/domain/Theme.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
* @author Trevor Smith
4242
*/
4343
public class Theme implements Buildable<Theme> {
44+
public static final UUID FUSIONAUTH_SIMPLE_THEME_ID = UUID.fromString("3c717291-5d83-4014-bd51-97c76475dc86");
45+
4446
public static final UUID FUSIONAUTH_THEME_ID = UUID.fromString("75a068fd-e94b-451a-9aeb-3ddb9a3b5987");
4547

4648
public Map<String, Object> data = new HashMap<>();
@@ -61,6 +63,10 @@ public class Theme implements Buildable<Theme> {
6163

6264
public Templates templates;
6365

66+
public ThemeType type = ThemeType.advanced;
67+
68+
public SimpleThemeVariables variables;
69+
6470
public Theme() {
6571
}
6672

@@ -72,7 +78,9 @@ public Theme(Theme theme) {
7278
this.lastUpdateInstant = theme.lastUpdateInstant;
7379
this.localizedMessages.putAll(theme.localizedMessages);
7480
this.name = theme.name;
81+
this.variables = theme.variables;
7582
this.stylesheet = theme.stylesheet;
83+
this.type = theme.type;
7684
if (theme.templates != null) {
7785
this.templates = new Templates(theme.templates);
7886
}
@@ -102,8 +110,10 @@ public boolean equals(Object o) {
102110
Objects.equals(lastUpdateInstant, that.lastUpdateInstant) &&
103111
Objects.equals(localizedMessages, that.localizedMessages) &&
104112
Objects.equals(name, that.name) &&
113+
Objects.equals(variables, that.variables) &&
105114
Objects.equals(stylesheet, that.stylesheet) &&
106-
Objects.equals(templates, that.templates);
115+
Objects.equals(templates, that.templates) &&
116+
Objects.equals(type, that.type);
107117
}
108118

109119
/**
@@ -135,7 +145,7 @@ public String formatZoneDateTime(ZonedDateTime zonedDateTime, String format, Zon
135145

136146
@Override
137147
public int hashCode() {
138-
return Objects.hash(data, defaultMessages, id, insertInstant, lastUpdateInstant, localizedMessages, name, stylesheet, templates);
148+
return Objects.hash(data, defaultMessages, id, insertInstant, lastUpdateInstant, localizedMessages, name, variables, stylesheet, templates, type);
139149
}
140150

141151
/**
@@ -152,7 +162,9 @@ public String message(String key, Object... arguments) {
152162

153163
@JsonIgnore
154164
public boolean missingTemplate() {
155-
if (templates == null) {
165+
if (ThemeType.simple.equals(type)) {
166+
return false;
167+
} else if (templates == null) {
156168
return true;
157169
}
158170

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2024, FusionAuth, All Rights Reserved
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an
12+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
* either express or implied. See the License for the specific
14+
* language governing permissions and limitations under the License.
15+
*/
16+
package io.fusionauth.domain;
17+
18+
public enum ThemeType {
19+
advanced,
20+
simple
21+
}

src/main/java/io/fusionauth/domain/search/ThemeSearchCriteria.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
/*
2-
* Copyright (c) 2023, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2023-2024, FusionAuth, All Rights Reserved
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an
12+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
* either express or implied. See the License for the specific
14+
* language governing permissions and limitations under the License.
315
*/
416
package io.fusionauth.domain.search;
517

618
import java.util.LinkedHashMap;
719
import java.util.Map;
820
import java.util.Set;
921

22+
import io.fusionauth.domain.ThemeType;
1023
import static io.fusionauth.domain.util.SQLTools.normalizeOrderBy;
1124
import static io.fusionauth.domain.util.SQLTools.toSearchString;
1225

@@ -20,6 +33,8 @@ public class ThemeSearchCriteria extends BaseSearchCriteria {
2033

2134
public String name;
2235

36+
public ThemeType type;
37+
2338
@Override
2439
public BaseSearchCriteria prepare() {
2540
if (orderBy == null) {

0 commit comments

Comments
 (0)