Commit 9c88f08e authored by Jérome Perrin's avatar Jérome Perrin

protect methods with AccessContentsInformation, not View

simplify some constructions
don't accept id_only=1 in getImmobilisationState, it's not part of workflow state getter API



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28087 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0090bbf8
This diff is collapsed.
...@@ -77,7 +77,7 @@ class ImmobilisationDelivery(XMLObject): ...@@ -77,7 +77,7 @@ class ImmobilisationDelivery(XMLObject):
, PropertySheet.Reference , PropertySheet.Reference
) )
security.declareProtected(Permissions.View, 'updateImmobilisationState') security.declareProtected(Permissions.AccessContentsInformation, 'updateImmobilisationState')
def updateImmobilisationState(self, **kw): def updateImmobilisationState(self, **kw):
""" """
This is often called as an activity, it will check if the This is often called as an activity, it will check if the
...@@ -94,7 +94,7 @@ class ImmobilisationDelivery(XMLObject): ...@@ -94,7 +94,7 @@ class ImmobilisationDelivery(XMLObject):
except ImmobilisationValidityError: except ImmobilisationValidityError:
self.calculateImmobilisationValidity() self.calculateImmobilisationValidity()
security.declareProtected(Permissions.View, 'getImmobilisationMovementList') security.declareProtected(Permissions.AccessContentsInformation, 'getImmobilisationMovementList')
def getImmobilisationMovementList(self, **kw): def getImmobilisationMovementList(self, **kw):
""" """
Return regular movements + immobilisation movements like Return regular movements + immobilisation movements like
...@@ -103,7 +103,7 @@ class ImmobilisationDelivery(XMLObject): ...@@ -103,7 +103,7 @@ class ImmobilisationDelivery(XMLObject):
return self.getMovementList(self.getPortalMovementTypeList() + return self.getMovementList(self.getPortalMovementTypeList() +
('Immobilisation Line', 'Immobilisation Cell'), **kw) ('Immobilisation Line', 'Immobilisation Cell'), **kw)
security.declareProtected(Permissions.View, 'checkImmobilisationConsistency') security.declareProtected(Permissions.AccessContentsInformation, 'checkImmobilisationConsistency')
def checkImmobilisationConsistency(self, *args, **kw): def checkImmobilisationConsistency(self, *args, **kw):
""" """
Check the consistency about immobilisation values Check the consistency about immobilisation values
...@@ -113,24 +113,23 @@ class ImmobilisationDelivery(XMLObject): ...@@ -113,24 +113,23 @@ class ImmobilisationDelivery(XMLObject):
return_list.extend(movement.checkImmobilisationConsistency()) return_list.extend(movement.checkImmobilisationConsistency())
return return_list return return_list
security.declareProtected(Permissions.View, 'isValidImmobilisationMovement') security.declareProtected(Permissions.AccessContentsInformation, 'isValidImmobilisationMovement')
def isValidImmobilisationMovement(self, *args, **kw): def isValidImmobilisationMovement(self, *args, **kw):
""" """
Return true if all submovements are valid in terms of immobilisation Return true if all submovements are valid in terms of immobilisation
""" """
error_list = self.checkImmobilisationConsistency(*args, **kw) error_list = self.checkImmobilisationConsistency(*args, **kw)
if len(error_list) == 0: return len(error_list) == 0
return 1
return 0
security.declareProtected(Permissions.View, 'isInvalidImmobilisationMovement') security.declareProtected(Permissions.AccessContentsInformation, 'isInvalidImmobilisationMovement')
def isInvalidImmobilisationMovement(self, *args, **kw): def isInvalidImmobilisationMovement(self, *args, **kw):
""" """
Return false if all submovements are valid in terms of immobilisation Return false if all submovements are valid in terms of immobilisation
""" """
return not self.isValidImmobilisationMovement(*args, **kw) return not self.isValidImmobilisationMovement(*args, **kw)
security.declareProtected(Permissions.View, 'getAggregatedItemsNextImmobilisationMovementValueList') security.declareProtected(Permissions.AccessContentsInformation,
'getAggregatedItemsNextImmobilisationMovementValueList')
def getAggregatedItemsNextImmobilisationMovementValueList(self, **kw): def getAggregatedItemsNextImmobilisationMovementValueList(self, **kw):
""" """
Return the list of each next immobilisation movement for each aggregated item Return the list of each next immobilisation movement for each aggregated item
......
...@@ -229,16 +229,17 @@ class ImmobilisationMovement(Movement, XMLObject): ...@@ -229,16 +229,17 @@ class ImmobilisationMovement(Movement, XMLObject):
return errors return errors
security.declareProtected(Permissions.View, 'checkImmobilisationConsistency') security.declareProtected(Permissions.AccessContentsInformation,
'checkImmobilisationConsistency')
def checkImmobilisationConsistency(self, *args, **kw): def checkImmobilisationConsistency(self, *args, **kw):
""" """
Checks the consistency about immobilisation values Checks the consistency about immobilisation values
""" """
return_value = self._checkImmobilisationConsistency(*args, **kw) return self._checkImmobilisationConsistency(*args, **kw)
return return_value
security.declareProtected(Permissions.View, 'getAmortisationMethodParameter') security.declareProtected(Permissions.AccessContentsInformation,
'getAmortisationMethodParameter')
def getAmortisationMethodParameter(self, parameter_list, **kw): def getAmortisationMethodParameter(self, parameter_list, **kw):
""" """
Returns a dictionary containing the value of each parameter Returns a dictionary containing the value of each parameter
...@@ -251,7 +252,8 @@ class ImmobilisationMovement(Movement, XMLObject): ...@@ -251,7 +252,8 @@ class ImmobilisationMovement(Movement, XMLObject):
return self.getAmortisationMethodParameterForItem(None, parameter_list, **kw) return self.getAmortisationMethodParameterForItem(None, parameter_list, **kw)
security.declareProtected(Permissions.View, 'getAmortisationMethodParameterForItem') security.declareProtected(Permissions.AccessContentsInformation,
'getAmortisationMethodParameterForItem')
def getAmortisationMethodParameterForItem(self, item, parameter_list, split_char=None, split_qty=3, **kw): def getAmortisationMethodParameterForItem(self, item, parameter_list, split_char=None, split_qty=3, **kw):
""" """
Returns a dictionary containing the value of each parameter Returns a dictionary containing the value of each parameter
...@@ -299,7 +301,8 @@ class ImmobilisationMovement(Movement, XMLObject): ...@@ -299,7 +301,8 @@ class ImmobilisationMovement(Movement, XMLObject):
return parameter_dict return parameter_dict
security.declareProtected(Permissions.View, 'getActualAmortisationMethodForItem') security.declareProtected(Permissions.AccessContentsInformation,
'getActualAmortisationMethodForItem')
def getActualAmortisationMethodForItem(self, item, **kw): def getActualAmortisationMethodForItem(self, item, **kw):
""" """
Returns the actual amortisation method by getting the previous Returns the actual amortisation method by getting the previous
...@@ -322,7 +325,8 @@ class ImmobilisationMovement(Movement, XMLObject): ...@@ -322,7 +325,8 @@ class ImmobilisationMovement(Movement, XMLObject):
return None return None
security.declareProtected(Permissions.View, 'getNeededSpecificParameterListForItem') security.declareProtected(Permissions.AccessContentsInformation,
'getNeededSpecificParameterListForItem')
def getNeededSpecificParameterListForItem(self, item, **kw): def getNeededSpecificParameterListForItem(self, item, **kw):
""" """
Returns the list of specific parameters which are Returns the list of specific parameters which are
...@@ -335,7 +339,8 @@ class ImmobilisationMovement(Movement, XMLObject): ...@@ -335,7 +339,8 @@ class ImmobilisationMovement(Movement, XMLObject):
**kw)["needed_specific_parameter_list"] **kw)["needed_specific_parameter_list"]
security.declareProtected(Permissions.View, 'getUncontinuousNeededSpecificParameterListForItem') security.declareProtected(Permissions.AccessContentsInformation,
'getUncontinuousNeededSpecificParameterListForItem')
def getUncontinuousNeededSpecificParameterListForItem(self, item, **kw): def getUncontinuousNeededSpecificParameterListForItem(self, item, **kw):
""" """
Returns the list of specific parameters which are Returns the list of specific parameters which are
...@@ -349,7 +354,8 @@ class ImmobilisationMovement(Movement, XMLObject): ...@@ -349,7 +354,8 @@ class ImmobilisationMovement(Movement, XMLObject):
**kw)["uncontinuous_needed_specific_parameter_list"] **kw)["uncontinuous_needed_specific_parameter_list"]
security.declareProtected(Permissions.View, 'getFacultativeSpecificParameterListForItem') security.declareProtected(Permissions.AccessContentsInformation,
'getFacultativeSpecificParameterListForItem')
def getFacultativeSpecificParameterListForItem(self, item, **kw): def getFacultativeSpecificParameterListForItem(self, item, **kw):
""" """
Returns the list of specific parameters which are Returns the list of specific parameters which are
...@@ -362,18 +368,19 @@ class ImmobilisationMovement(Movement, XMLObject): ...@@ -362,18 +368,19 @@ class ImmobilisationMovement(Movement, XMLObject):
**kw)["facultative_specific_parameter_list"] **kw)["facultative_specific_parameter_list"]
security.declareProtected(Permissions.View, 'isUsingAmortisationMethod') security.declareProtected(Permissions.AccessContentsInformation,
'isUsingAmortisationMethod')
def isUsingAmortisationMethod(self, method): def isUsingAmortisationMethod(self, method):
""" """
Return true if this item is using the given method Return true if this item is using the given method
""" """
if self.getAmortisationMethod() == method: return self.getAmortisationMethod() == method
return 1
return 0
security.declareProtected(Permissions.View, 'getImmobilisationState') security.declareProtected(Permissions.AccessContentsInformation,
def getImmobilisationState(self, id_only=1): 'getImmobilisationState')
def getImmobilisationState(self):
""" """
Return root delivery immobilisation state Return root delivery immobilisation state
""" """
return self.getRootDeliveryValue().getImmobilisationState() return self.getRootDeliveryValue().getImmobilisationState()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment