Skip to content

Commit

Permalink
feat(CO-1295): define new carbonioFeatureWscEnabled attribute (#564)
Browse files Browse the repository at this point in the history
* chore: remove magic string

* chore: define new carbonioFeatureWscEnabled attribute

* feat: define new carbonioFeatureWscEnabled attribute

* feat: define carbonioFeatureWscEnabled feature in SearchUsersByFeatureRequest

* test: change total attributes count in assert
  • Loading branch information
matteobaglini authored Aug 19, 2024
1 parent ab9edf7 commit 8ae839a
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2965,6 +2965,14 @@ public static TwoFactorAuthSecretEncoding fromString(String s) throws ServiceExc
@ZAttr(id=3132)
public static final String A_carbonioFeatureTeamEnabled = "carbonioFeatureTeamEnabled";

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public static final String A_carbonioFeatureWscEnabled = "carbonioFeatureWscEnabled";

/**
* Logo URL for domain
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.zimbra.soap.account.message;

import com.zimbra.common.account.ZAttrProvisioning;
import com.zimbra.common.soap.AccountConstants;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
Expand All @@ -16,7 +17,8 @@
public class SearchUsersByFeatureRequest {

public enum Features {
CHATS("carbonioFeatureChatsEnabled"),
CHATS(ZAttrProvisioning.A_carbonioFeatureChatsEnabled),
WSC(ZAttrProvisioning.A_carbonioFeatureWscEnabled),
UNKNOWN("");

private final String feature;
Expand Down
72 changes: 72 additions & 0 deletions store/src/main/java/com/zimbra/cs/account/ZAttrAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,78 @@ public Map<String,Object> unsetCarbonioFeatureTeamEnabled(Map<String,Object> att
return attrs;
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @return carbonioFeatureWscEnabled, or false if unset
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public boolean isCarbonioFeatureWscEnabled() {
return getBooleanAttr(ZAttrProvisioning.A_carbonioFeatureWscEnabled, false, true);
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @param carbonioFeatureWscEnabled new value
* @throws com.zimbra.common.service.ServiceException if error during update
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public void setCarbonioFeatureWscEnabled(boolean carbonioFeatureWscEnabled) throws com.zimbra.common.service.ServiceException {
HashMap<String,Object> attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioFeatureWscEnabled, carbonioFeatureWscEnabled ? TRUE : FALSE);
getProvisioning().modifyAttrs(this, attrs);
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @param carbonioFeatureWscEnabled new value
* @param attrs existing map to populate, or null to create a new map
* @return populated map to pass into Provisioning.modifyAttrs
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public Map<String,Object> setCarbonioFeatureWscEnabled(boolean carbonioFeatureWscEnabled, Map<String,Object> attrs) {
if (attrs == null) attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioFeatureWscEnabled, carbonioFeatureWscEnabled ? TRUE : FALSE);
return attrs;
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @throws com.zimbra.common.service.ServiceException if error during update
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public void unsetCarbonioFeatureWscEnabled() throws com.zimbra.common.service.ServiceException {
HashMap<String,Object> attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioFeatureWscEnabled, "");
getProvisioning().modifyAttrs(this, attrs);
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @param attrs existing map to populate, or null to create a new map
* @return populated map to pass into Provisioning.modifyAttrs
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public Map<String,Object> unsetCarbonioFeatureWscEnabled(Map<String,Object> attrs) {
if (attrs == null) attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioFeatureWscEnabled, "");
return attrs;
}

/**
* Whether Carbonio can send analytics reports for Account
*
Expand Down
72 changes: 72 additions & 0 deletions store/src/main/java/com/zimbra/cs/account/ZAttrCos.java
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,78 @@ public Map<String,Object> unsetCarbonioFeatureTeamEnabled(Map<String,Object> att
return attrs;
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @return carbonioFeatureWscEnabled, or false if unset
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public boolean isCarbonioFeatureWscEnabled() {
return getBooleanAttr(ZAttrProvisioning.A_carbonioFeatureWscEnabled, false, true);
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @param carbonioFeatureWscEnabled new value
* @throws com.zimbra.common.service.ServiceException if error during update
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public void setCarbonioFeatureWscEnabled(boolean carbonioFeatureWscEnabled) throws com.zimbra.common.service.ServiceException {
HashMap<String,Object> attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioFeatureWscEnabled, carbonioFeatureWscEnabled ? TRUE : FALSE);
getProvisioning().modifyAttrs(this, attrs);
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @param carbonioFeatureWscEnabled new value
* @param attrs existing map to populate, or null to create a new map
* @return populated map to pass into Provisioning.modifyAttrs
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public Map<String,Object> setCarbonioFeatureWscEnabled(boolean carbonioFeatureWscEnabled, Map<String,Object> attrs) {
if (attrs == null) attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioFeatureWscEnabled, carbonioFeatureWscEnabled ? TRUE : FALSE);
return attrs;
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @throws com.zimbra.common.service.ServiceException if error during update
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public void unsetCarbonioFeatureWscEnabled() throws com.zimbra.common.service.ServiceException {
HashMap<String,Object> attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioFeatureWscEnabled, "");
getProvisioning().modifyAttrs(this, attrs);
}

/**
* Whether the WS-Collaboration feature enabled for account or COS
*
* @param attrs existing map to populate, or null to create a new map
* @return populated map to pass into Provisioning.modifyAttrs
*
* @since ZCS 24.9.0
*/
@ZAttr(id=3145)
public Map<String,Object> unsetCarbonioFeatureWscEnabled(Map<String,Object> attrs) {
if (attrs == null) attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioFeatureWscEnabled, "");
return attrs;
}

/**
* Whether Carbonio can send analytics reports for Account
*
Expand Down
6 changes: 6 additions & 0 deletions store/src/main/resources/conf/attrs/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10146,4 +10146,10 @@ TODO: delete them permanently from here
<desc>Whether OTP management (creation, listing and deletion) is enabled for account or COS</desc>
</attr>

<attr id="3145" name="carbonioFeatureWscEnabled" type="boolean" cardinality="single" optionalIn="account,cos" flags="accountInfo,accountInherited,domainAdminModifiable" since="24.9.0">
<defaultCOSValue>FALSE</defaultCOSValue>
<defaultExternalCOSValue>FALSE</defaultExternalCOSValue>
<desc>Whether the WS-Collaboration feature enabled for account or COS</desc>
</attr>

</attrs>
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<a n="carbonioFeatureMeetingEnabled"/>
<a n="carbonioFeatureOTPMgmtEnabled"/>
<a n="carbonioFeatureTeamEnabled"/>
<a n="carbonioFeatureWscEnabled"/>
<a n="carbonioPrefSendAnalytics"/>
<a n="carbonioPrefWebUiDarkMode"/>
<a n="cn"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ void shouldLoadAllAttributesFromAttrsFile() throws ServiceException {

private void assertLoadedAllAttributes(AttributeManager attributeManager) {
final Map<String, AttributeInfo> allAttrs = attributeManager.getAttrs();
assertEquals(1844, allAttrs.size());
assertEquals(1845, allAttrs.size());
}
}

0 comments on commit 8ae839a

Please sign in to comment.