def access_storage_edit(name, cid, uid, perm, **kwargs):
    """
    Edits ACL for the specified collection.

    Creates if necessary.
    """
    ctx = Context(**kwargs)
    ctx.execute_action('access:storage:edit', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
        'cids': cid,
        'uids': uid,
        'perm': perm,
    })