AllMotechSecurityRules¶
-
public class
AllMotechSecurityRules
¶ Implementation of DAO interface that utilizes a MDS back-end for storage. Only one MotechSecurityConfiguration file should be saved at a time, so adding the document looks for the old document in order to update it if it already exists. Rather than updating the object reference, the old configuration’s ID and revision are used for the new document.
Methods¶
addOrUpdate¶
-
public void
addOrUpdate
(MotechSecurityConfiguration config)¶ Reads rules from
org.motechproject.security.domain.MotechSecurityConfiguration
and split them into those to be created, updated or removed. Before updatingorg.motechproject.security.repository.MotechURLSecurityRuleDataService
is checked for old rule with the same id - update will be done only if it exists. Same thing happens for rules to be removed.Parameters: - config –
getMotechSecurityConfiguration¶
-
public MotechSecurityConfiguration
getMotechSecurityConfiguration
()¶ Gets MotechSecurityConfiguration
Returns: configuration
getRuleById¶
-
public MotechURLSecurityRule
getRuleById
(Long id)¶ Returns MotechURLSecurityRule for given id
Parameters: - id – of security rule
Returns: rule with given id or null in case when id == null
getRules¶
-
public List<MotechURLSecurityRule>
getRules
()¶ Returns all MotechURLSecurityRules
Returns: list that contains rules
getRulesByOrigin¶
-
public List<MotechURLSecurityRule>
getRulesByOrigin
(String origin)¶ Returns all MotechURLSecurityRules for given origin
Parameters: - origin – of security rules
Returns: list that contains rules or null in case origin is null
getRulesByOriginAndVersion¶
-
public List<MotechURLSecurityRule>
getRulesByOriginAndVersion
(String origin, String version)¶ Returns all MotechURLSecurityRules for given origin and version
Parameters: - origin – of security rules
- version – of security rules
Returns: list that contains rules or empty list in case origin or version is null
remove¶
-
public void
remove
(MotechSecurityConfiguration config)¶ Removes all rules from given MotechSecurityConfiguration
Parameters: - config – with rules to be removed
setDataService¶
-
public void
setDataService
(MotechURLSecurityRuleDataService dataService)¶