示例#1
0
  def anonymousLinkOK( self, targetObject, targetFieldID, sourceObject,
      sourceFieldID, gsession ):
    '''
    This method is used to control whether or not it is acceptable to make a
    link to the given field in this {@link arlut.csd.ganymede.server.DBObject
    DBObject} type when the user only has editing access for the source {@link
    arlut.csd.ganymede.server.InvidDBField InvidDBField} and not the target.
   
    This version of anonymousLinkOK takes additional parameters to allow an
    object type to decide that it does or does not want to allow a link based
    on what field of what object wants to link to it.
   
    By default, the 3 variants of the DBEditObject anonymousLinkOK() method are
    chained together, so that the customizer can choose which level of detail
    he is interested in.  {@link arlut.csd.ganymede.server.InvidDBField
    InvidDBField}s {@link arlut.csd.ganymede.server.InvidDBField#bind(
    arlut.csd.ganymede.common.Invid,arlut.csd.ganymede.common.Invid,boolean)
    bind()} method calls this version.  This version calls the three parameter
    version, which calls the two parameter version, which returns false by
    default.  Customizers can implement any of the three versions, but unless
    you maintain the version chaining yourself, theres no point to
    implementing more than one of them.  
    '''
    # If someone tries to put this list in another email list, let them.
    # Type 274 is Email List, and field 257 is Members.
    if targetFieldID == SchemaConstants.BackLinksField and \
        sourceObject.getTypeID() == 274  and \
        sourceFieldID == self.MEMBERS_FIELD_ID:
      return true

    # The default anonymousLinkOK method returns false
    return BaseJythonEditObject.anonymousLinkOK( self, targetObject,
        targetFieldID, sourceObject, sourceFieldID, gsession )