File management the module IMCE

Created on 13 November 2022, about 2 years ago
Updated 5 February 2023, almost 2 years ago

I'm trying to have an email sent to admin if a file is uploaded and downloaded.

Is there a way to indentify the a file being uploaded or downloaded using the private filing system?

πŸ’¬ Support request
Status

Fixed

Version

1.1

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    I'm not sure I understand your last comment. Is it working or not?

    setup and email and in the message I put.

    [current-user:name] downloaded [FileDownloadPath].

    That looks about right.

    But I don't know how to use the token.

    Well, just like you did above. That should do it.

    If that does not work though, then you should use one of the debugging methods described at https://ecaguide.org/eca/debugging/ and see where it breaks. If you can't find out that way, you may have to post the debugging output here so that we can have a look.

  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    Yes the the email is being initiated but when I put the token into the body it is not showing in the email.

    So I have 2 actions

    1. Reguest:Get uri - token name [filedownloadpath]

    2. send email - I put the token into the message & the body and neither are showing up

    It seams like the token is not being registered or saved, I did notice that there is a function of setting a token do I use that somehow?

    I will try to debug and read more of your manuals this weekend.

    Again thanks for your help.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    You could upload your model for review. One possible error I spotted in your last comment:

    Reguest:Get uri - token name [filedownloadpath]

    In the field "Token name" you should only provide the name of the token, i.e. without brackets. The syntax [filedownloadpath] is used when you want the system to replace that with the value of the token. But when storing a value into a token, the field only asks for the identifier, i.e. the name of the token.

  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    Here is the model:

    uuid: dcc6182c-401c-4a81-a122-dfd60e8b4a06
    langcode: en
    status: true
    dependencies:
    module:
    - eca_endpoint
    - eca_misc
    id: download_file_notification
    modeller: core
    label: 'Download file notification'
    version: ''
    weight: -10
    events:
    kernel_finish_request:
    plugin: 'kernel:finish_request'
    label: 'Response for request created'
    configuration: { }
    successors:
    -
    id: action_send_email_action
    condition: eca_route_match
    conditions:
    eca_route_match:
    plugin: eca_route_match
    configuration:
    request: '2'
    route: system.files
    operator: equal
    type: value
    case: false
    negate: false
    gateways: { }
    actions:
    eca_endpoint_get_request_uri:
    plugin: eca_endpoint_get_request_uri
    label: 'Request: Get uri'
    configuration:
    token_name: filedownloadpath
    successors: { }
    action_send_email_action:
    plugin: action_send_email_action
    label: 'Send email'
    configuration:
    recipient: '[site:mail]'
    subject: '[current-user:name] downloaded a file [filedownloadpath]'
    message: '[current-user:name] downloaded [filedownloadpath]'
    replace_tokens: false
    successors: { }

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Sorry @10thstreetlabel that's not very helpful in this format. Please export your model from /admin/config/workflow/eca where you can find an export in the operations column. That exports into a gz file that you then can upload here.

  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    I don't have that option on the operations dropdown, I have edit, disable, clone & delete.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Are you using the ECA Core Modeller or BPMN.io? The latter provides that option, the former doesn't.

    If you can't export from the ECA overview, you can export the config from your site and then upload the 2 yml files that belong to your model: eca.eca.*.yml and eca.model.*.yml.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    I'm sorry but export the config from your site is that a file inside the eca or somewhere else?

    I tried to find the eca.model.*.yml that belongs to my model but I don't know where to find those either.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Configuration management is a core feature. I thought, that's something every site uses that, but maybe not. What it means is that configuration exists in the database, but with config management, it can be exported into the file system too. That creates a yml file for each config object that exists on that Drupal site. This is useful when you work on a site in your local development environment, and you want to deploy your config changes to the live site. Then you export the config locally, deploy the set of config files to the live site and import the config there. This is how one can update the config of live sites from the local development environment.

    Other than that, you can use the latest dev releases of ECA and ECA Core Modeller, which will now also support of exporting models for the eca_cm models.

  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    I'm an accountant but I've been using drupal for 13 years and it is a hobby but I would like to turn it into something more. My accounting site was build on D7 with some modules that did not migrate to D9 and D10. I managed to get most of D10 working but I can't get this last part finished.

    You are the only one that is consistent in the help which I appreciate since I reached out to several people over the last two years.

    Thanks for config explanation and I will put that into my to do.

    I did DL the lastest and thanks for mod update.

    I'm attaching the export.

  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    OK I don't get it.

    I started to work with bpmn_io modeler and now it works. Entered in the same stuff I think and it is working..

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Ah, looks like the file core-download_file_notification.tar_.gz explains the problem: the event "Response for request created" only has 1 successor "Send email" with the condition to check the route. The other action "Request: Get uri" exists in the model but is not linked into the flow.

    So, the missing piece seems to be that the second action needs to be declared as a successor to the first action. And that most certainly also the difference to the bpmn_io model, where linking together the flow of actions is a bit more inuitive.

  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    Can you help me with the upload side?

    I'm trying to include the file name in the email but can only get a upload file.

    I uploaded the export.

    Thanks

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Entity related events are adding the entity to the token system under the name entity. That means, you have to use the tokens for the file entity with the name entity instead of file, i.e. [entity:name] or [entity:url] instead of [file:name] or [file:url].

    Like I mentioned already above in #7 and #17, you really want to make the debugging tool your friend, because that shows you exactly which tokens are available for you at which step in the process.

  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    I got it to work and will try to learn more about the debugging more.

    Thank you for your help.

  • Status changed to Fixed almost 2 years ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    jurgenhaas

    I thought I was done but not still need your help.

    So I need an email sent to the admin when there is a new file uploaded which I was able to complete for now.

    The admin is also going into a client folder and uploading a file in the client directory since they have access to their folder.
    Directory setup is private://users/user

    I'm using the log and tried to mess with the function "Execute models with user" but I don't how to use it.

    I think I start out with "insert content entity" because that worked with my general upload email model.

    But i'm having problems with getting the user name and associated email address.

    Aslo I see various tokens being used but I can't figure out how to find them. I know the token module lists some of them but ECA referrences others. If I do find them I can use them on a basic way but I not sure how to modify them. ie [session_user:uid], how would I try to identify a specific user like user 2. More importantely can you direct me to some knowledge base so I can learn this on my own?

    Thanks for you help.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Not sure I fully understand. The current user doing something on the site is an admin. But you're interested in tokens for the admin, you need a token for a different user? How would you identify that other user?

  • πŸ‡ΊπŸ‡ΈUnited States 10thstreetlabel

    Yes the current user is admin(me) and I upload a file into their directory or folder.

    We exchange files, they upload their accounting file(and email goes to me that they uploaded the file - I have this worked out) I work on it and then I upload it again( this email is the one that I'm having problems with).

    So the the admin is uploading a file into another user's folder.

    It is a provate folder so they only have access to their folder.

    I have it so when I'm done with the file and I reupload it then they are notifiied that I did so.

    The file structure is:
    private://users/user

    The URL looks like:
    system/files/users/user/****.pdf

    Model:
    Initialize content entity
    type: File:-any-

    Send email
    Recipient email address: ???

    Subject: [file:owner]

    Message: [file:owner] [file:path]

    Note: The file path shows the user's name bu not sure how to get that and use their email address in the Recipient email address?

    Thanks again for you help.

    Do you have a venmo account I would like to buy you a couple of cups of coffee?

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Note: The file path shows the user's name bu not sure how to get that and use their email address in the Recipient email address?

    This is the key thing: we need something to identify the user to whom you want to send an email. If the user name in the path is the only thing you have, then you need to extract that name somehow from the path (maybe with some action plugins from the eca_tamper module) and then you can use the action Load entity to load the user entity by the name property. Once you have that, you have the tokens available you're looking for.

    Do you have a venmo account I would like to buy you a couple of cups of coffee?

    That's kind of you. Don't have such an account yet but we're planning to setup some crowdfunding for the ECA project so that people can support us in the long run.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024