Skip to content

Commit

Permalink
fix: skin related code cleanup (#304)
Browse files Browse the repository at this point in the history
- remove GetAllSkins, GetAvailableSkins SOAP APIs
- remove reference from Auth request
- remove option to flush skin cache form FlushCache class
- remove SkinUtil class and its usage

rif:  [CO-815]
  • Loading branch information
keshavbhatt authored Aug 10, 2023
1 parent 3243ff4 commit c057969
Show file tree
Hide file tree
Showing 19 changed files with 541 additions and 965 deletions.
84 changes: 40 additions & 44 deletions client/src/main/java/com/zimbra/client/ZAuthResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,60 +14,56 @@

public class ZAuthResult {

private long expires;
private AuthResponse data;
private long expires;
private AuthResponse data;

public ZAuthResult(AuthResponse res) {
data = res;
expires = data.getLifetime() + System.currentTimeMillis();
}
public ZAuthResult(AuthResponse res) {
data = res;
expires = data.getLifetime() + System.currentTimeMillis();
}

public ZAuthToken getAuthToken() {
return new ZAuthToken(data.getAuthToken());
}
public ZAuthToken getAuthToken() {
return new ZAuthToken(data.getAuthToken());
}

public String getSessionId() {
Session session = data.getSession();
if (session == null) {
return null;
}
return session.getId();
public String getSessionId() {
Session session = data.getSession();
if (session == null) {
return null;
}
return session.getId();
}

void setSessionId(String id) {
Session session = data.getSession();
if (session == null) {
session = new Session();
data.setSession(session);
}
session.setId(id);
void setSessionId(String id) {
Session session = data.getSession();
if (session == null) {
session = new Session();
data.setSession(session);
}
session.setId(id);
}

public long getExpires() {
return expires;
}

public long getLifetime() {
return data.getLifetime();
}
public long getExpires() {
return expires;
}

public String getRefer() {
return data.getRefer();
}
public long getLifetime() {
return data.getLifetime();
}

public Map<String, List<String>> getAttrs() {
return MapUtil.multimapToMapOfLists(data.getAttrsMultimap());
}
public String getRefer() {
return data.getRefer();
}

public Map<String, List<String>> getPrefs() {
return MapUtil.multimapToMapOfLists(data.getPrefsMultimap());
}
public Map<String, List<String>> getAttrs() {
return MapUtil.multimapToMapOfLists(data.getAttrsMultimap());
}

public String getSkin() {
return data.getSkin();
}
public Map<String, List<String>> getPrefs() {
return MapUtil.multimapToMapOfLists(data.getPrefsMultimap());
}

public String getCsrfToken() {
return data.getCsrfToken();
}
public String getCsrfToken() {
return data.getCsrfToken();
}
}
26 changes: 0 additions & 26 deletions client/src/main/java/com/zimbra/client/ZMailbox.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ public static class Options {
private ZEventHandler mHandler;
private List<String> mAttrs;
private List<String> mPrefs;
private String mRequestedSkin;
private boolean mCsrfSupported; // Used by AuthRequest
private Map<String, String> mCustomHeaders;
private SoapTransport.NotificationFormat notificationFormat =
Expand Down Expand Up @@ -674,15 +673,6 @@ public Options setAttrs(List<String> attrs) {
return this;
}

public String getRequestedSkin() {
return mRequestedSkin;
}

public Options setRequestedSkin(String skin) {
mRequestedSkin = skin;
return this;
}

public boolean getCsrfSupported() {
return mCsrfSupported;
}
Expand Down Expand Up @@ -969,7 +959,6 @@ public ZAuthResult authByPassword(Options options, String password) throws Servi
AuthRequest auth = new AuthRequest(account, password);
auth.setPassword(password);
auth.setVirtualHost(options.getVirtualHost());
auth.setRequestedSkin(options.getRequestedSkin());
auth.setCsrfSupported(options.getCsrfSupported());
if (options.getAuthToken() != null) {
auth.setAuthToken(new AuthToken(options.getAuthToken().getValue(), false));
Expand All @@ -988,7 +977,6 @@ public ZAuthResult authByAuthToken(Options options) throws ServiceException {
AuthRequest req = new AuthRequest();
ZAuthToken zat = options.getAuthToken(); // cannot be null here
req.setAuthToken(new AuthToken(zat.getValue(), false));
req.setRequestedSkin(options.getRequestedSkin());
req.setCsrfSupported(options.getCsrfSupported());
addAttrsAndPrefs(req, options);

Expand Down Expand Up @@ -5660,20 +5648,6 @@ public void modifyPrefs(Map<String, ? extends Object> prefs) throws ServiceExcep
invoke(req);
}

public List<String> getAvailableSkins() throws ServiceException {
Element req = newRequestElement(AccountConstants.GET_AVAILABLE_SKINS_REQUEST);
Element resp = invoke(req);
List<String> result = new ArrayList<String>();
for (Element skin : resp.listElements(AccountConstants.E_SKIN)) {
String name = skin.getAttribute(AccountConstants.A_NAME, null);
if (name != null) {
result.add(name);
}
}
Collections.sort(result);
return result;
}

public List<String> getAvailableLocales() throws ServiceException {
Element req = newRequestElement(AccountConstants.GET_AVAILABLE_LOCALES_REQUEST);
Element resp = invoke(req);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ private AccountConstants() {
public static final String E_GET_ALL_LOCALES_RESPONSE = "GetAllLocalesResponse";
public static final String E_GET_AVAILABLE_LOCALES_REQUEST = "GetAvailableLocalesRequest";
public static final String E_GET_AVAILABLE_LOCALES_RESPONSE = "GetAvailableLocalesResponse";
public static final String E_GET_AVAILABLE_SKINS_REQUEST = "GetAvailableSkinsRequest";
public static final String E_GET_AVAILABLE_SKINS_RESPONSE = "GetAvailableSkinsResponse";
public static final String E_GET_AVAILABLE_CSV_FORMATS_REQUEST = "GetAvailableCsvFormatsRequest";
public static final String E_GET_AVAILABLE_CSV_FORMATS_RESPONSE =
"GetAvailableCsvFormatsResponse";
Expand Down Expand Up @@ -172,10 +170,6 @@ private AccountConstants() {
QName.get(E_GET_AVAILABLE_LOCALES_REQUEST, NAMESPACE);
public static final QName GET_AVAILABLE_LOCALES_RESPONSE =
QName.get(E_GET_AVAILABLE_LOCALES_RESPONSE, NAMESPACE);
public static final QName GET_AVAILABLE_SKINS_REQUEST =
QName.get(E_GET_AVAILABLE_SKINS_REQUEST, NAMESPACE);
public static final QName GET_AVAILABLE_SKINS_RESPONSE =
QName.get(E_GET_AVAILABLE_SKINS_RESPONSE, NAMESPACE);
public static final QName GET_AVAILABLE_CSV_FORMATS_REQUEST =
QName.get(E_GET_AVAILABLE_CSV_FORMATS_REQUEST, NAMESPACE);
public static final QName GET_AVAILABLE_CSV_FORMATS_RESPONSE =
Expand Down Expand Up @@ -365,7 +359,6 @@ private AccountConstants() {
public static final String E_ENTRY_SEARCH_FILTER_SINGLECOND = "cond";
public static final String E_LOCALE = "locale";
public static final String E_VIRTUAL_HOST = "virtualHost";
public static final String E_SKIN = "skin";
public static final String E_HAB_ROOTS = "habRoots";
public static final String E_HAB = "hab";
public static final String E_IDENTITIES = "identities";
Expand All @@ -378,7 +371,6 @@ private AccountConstants() {
public static final String E_CHILD_ACCOUNTS = "childAccounts";
public static final String E_CHILD_ACCOUNT = "childAccount";
public static final String E_CONTENT = "content";
public static final String E_REQUESTED_SKIN = "requestedSkin";
public static final String E_REST = "rest";
public static final String E_CSV = "csv";
public static final String E_COS = "cos";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,6 @@ private AdminConstants() {
public static final String E_VERIFY_STORE_MANAGER_REQUEST = "VerifyStoreManagerRequest";
public static final String E_VERIFY_STORE_MANAGER_RESPONSE = "VerifyStoreManagerResponse";

// Skins
public static final String E_GET_ALL_SKINS_REQUEST = "GetAllSkinsRequest";
public static final String E_GET_ALL_SKINS_RESPONSE = "GetAllSkinsResponse";

public static final QName PING_REQUEST = QName.get(E_PING_REQUEST, NAMESPACE);
public static final QName PING_RESPONSE = QName.get(E_PING_RESPONSE, NAMESPACE);
public static final QName CHECK_HEALTH_REQUEST = QName.get(E_CHECK_HEALTH_REQUEST, NAMESPACE);
Expand Down Expand Up @@ -1216,10 +1212,6 @@ private AdminConstants() {
public static final QName VERIFY_STORE_MANAGER_RESPONSE =
QName.get(E_VERIFY_STORE_MANAGER_RESPONSE, NAMESPACE);

// Skins
public static final QName GET_ALL_SKINS_REQUEST = QName.get(E_GET_ALL_SKINS_REQUEST, NAMESPACE);
public static final QName GET_ALL_SKINS_RESPONSE = QName.get(E_GET_ALL_SKINS_RESPONSE, NAMESPACE);

public static final String E_FILTER_RULES = "filterRules";
public static final String E_FILTER_RULE = "filterRule";
public static final String E_GET_FILTER_RULES_REQUEST = "GetFilterRulesRequest";
Expand Down Expand Up @@ -1375,7 +1367,6 @@ private AdminConstants() {
public static final String E_ENTRY = "entry";
public static final String E_KEY = "key";
public static final String E_PRINCIPAL = "principal";
public static final String E_SKIN = "skin";
public static final String E_TOKEN = "token";

// HAB
Expand Down
4 changes: 0 additions & 4 deletions soap/src/main/java/com/zimbra/soap/JaxbUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ public final class JaxbUtil {
com.zimbra.soap.account.message.GetAvailableCsvFormatsResponse.class,
com.zimbra.soap.account.message.GetAvailableLocalesRequest.class,
com.zimbra.soap.account.message.GetAvailableLocalesResponse.class,
com.zimbra.soap.account.message.GetAvailableSkinsRequest.class,
com.zimbra.soap.account.message.GetAvailableSkinsResponse.class,
com.zimbra.soap.account.message.GetDistributionListMembersRequest.class,
com.zimbra.soap.account.message.GetDistributionListMembersResponse.class,
com.zimbra.soap.account.message.GetDistributionListRequest.class,
Expand Down Expand Up @@ -362,8 +360,6 @@ public final class JaxbUtil {
com.zimbra.soap.admin.message.GetAllRightsResponse.class,
com.zimbra.soap.admin.message.GetAllServersRequest.class,
com.zimbra.soap.admin.message.GetAllServersResponse.class,
com.zimbra.soap.admin.message.GetAllSkinsRequest.class,
com.zimbra.soap.admin.message.GetAllSkinsResponse.class,
com.zimbra.soap.admin.message.GetAllVolumesRequest.class,
com.zimbra.soap.admin.message.GetAllVolumesResponse.class,
com.zimbra.soap.admin.message.GetAllXMPPComponentsRequest.class,
Expand Down
Loading

0 comments on commit c057969

Please sign in to comment.