

@access.user
@loadmodel(model='item', level=AccessType.READ)
@filtermodel(model='item')
@describeRoute(Description('Copy an item.').responseClass('Item').param('id', 'The ID of the original item.', paramType='path').param('folderId', 'The ID of the parent folder.', required=False).param('name', 'Name for the new item.', required=False).param('description', 'Description for the new item.', required=False).errorResponse().errorResponse('ID was invalid.').errorResponse('Read access was denied on the original item.', 403).errorResponse('Write access was denied on the parent folder.', 403))
def copyItem(self, item, params):
    '\n        Copy an existing item to a new item.\n\n        :param folderId: The _id of the parent folder for the new item.\n        :type folderId: str\n        :param name: The name of the item to create.\n        :param description: Item description.\n        '
    user = self.getCurrentUser()
    name = params.get('name', None)
    folderId = params.get('folderId', item['folderId'])
    folder = self.model('folder').load(id=folderId, user=user, level=AccessType.WRITE, exc=True)
    description = params.get('description', None)
    return self.model('item').copyItem(item, creator=user, name=name, folder=folder, description=description)

dataset/ETHPy150Open girder/girder/girder/api/v1/item.py Item.copyItem/original