Skip to main content
mollyn6512
April 17, 2024
Question

Basic User cannot upload file into folder until adding him into administrator group

  • April 17, 2024
  • 12 replies
  • 0 views

NOTE: PLEASE SEE MY LATEST UPDATES ON MY ISSUE ON THE COMMENT SECTION.

Hi every one, not sure if you have experienced this before:

The given requirement is to create an interface with a file upload field. With that file,check if the file format is csv, and if all the columns's header name are the right name and are in the right order). 

My code is attached below. The issue is that when the basic user's account is given viewer permission in my document folder, the file was not uploaded succesfully to the folder. If you have any recommendation please reach out. Thank you [emoticon:c4563cd7d5574777a71c318021cbbcc8]

 

a!localVariables(
  local!document,
  local!uploadSuccess,
  local!correctFileFormat,
  a!fileUploadField(
    label: "File",
    target: cons!INCOMMing_DOCUMENTS,
    maxSelections: 1,
    value: local!document,
    saveInto: {
      a!save(local!uploadSuccess, false),
      local!document,
      if(
        a!isNullOrEmpty(local!document),
        {},
        a!submitUploadedFiles(
          onSuccess: {
            a!save(local!uploadSuccess, true),
            a!save(
              local!correctFileFormat,
              a!localVariables(
                local!validCSV: difference(
                  upper(document(ri!uploadFile, "extension")),
                  "CSV"
                ) < 0,
                if(
                  local!validCSV,
                  a!localVariables(
                    local!extractFile: previewcsvforimport(
                      document: ri!uploadFile,
                      delimiter: ",",
                      charset: "UTF-8",
                      numberOfRows: 6
                    ).data,
                    local!nullFile: a!isNullOrEmpty(local!extractFile),
                    local!previewFile: if(
                      local!nullFile = true,
                      null,
                      local!extractFile[1]
                    ),
                    and(
                      local!nullFile = false,
                      exact(
                        stripwith(upper(local!previewFile[1]), "/ (),."),
                        upper(
                          stripwith("File Name / Message ID", "/ (),.")
                        )
                      ),
                      exact(
                        stripwith(upper(local!previewFile[2]), "/ (),."),
                        upper(stripwith("Service", "/ (),."))
                      ),
                      exact(
                        stripwith(upper(local!previewFile[3]), "/ (),."),
                        upper(stripwith("Type", "/ (),."))
                      ),
                      exact(
                        stripwith(upper(local!previewFile[4]), "/ (),."),
                        upper(stripwith("Date Received", "/ (),."))
                      ),
                      exact(
                        stripwith(upper(local!previewFile[5]), "/ (),."),
                        upper(stripwith("Status", "/ (),."))
                      )
                    )
                  ),
                  false
                )
              )
            )
          },
          onError: a!save(local!uploadSuccess, false),
          documents: local!document
        )
      )
    },
    required: true(),
    validations: a!localVariables(
      local!invalidExtensions: difference(upper(fv!files.extension), "CSV"),
      if(
        length(local!invalidExtensions) > 0,
        "Attachments must be csv files. Please remove: " & index(fv!files, "name", {}),
        if(
          and(
            a!isNotNullOrEmpty(local!document),
            local!correctFileFormat = false
          ),
          "Please upload a file following required format",
          ""
        )
      )
    )
  )
)

    12 replies

    karumurua531442
    April 17, 2024

    hi [mention:b18d9a2f367a407ca0cf8a9b71bef972:e9ed411860ed4f2ba0265705b8793d05]  is your basic user having access to document folder?

    mollyn6512
    April 17, 2024

    HI [mention:3510a5189ce1477eaf2e09f5858c87e9:e9ed411860ed4f2ba0265705b8793d05]  I don't have access to Appian Designer when being basic user

    gopalk2865
    Participating Frequently
    April 17, 2024

    Try giving basic user editor permission of the folder where uploaded document is getting saved.

    karthikk538
    April 17, 2024

    Hi Mollyn,

    Try executing the same in script task and make sure the script task assignment is marked as "Run as whosoever designed the process model".

    mollyn6512
    April 17, 2024

    Hi @karthikk538, my interface is actually a page, and I want the validation to be displayed in my interface right after uploading so that user can re-upload right away, not after kicking off the process model, because (please correct me if I'm wrong) you can not use a page as process start form. 

    venkatrea696188
    April 17, 2024
    because (please correct me if I'm wrong) you can not use a page as process start form. 

    We can, Action type page we can define a process which has start form.(But submituploadedfiles don't work in Start form).

    my interface is actually a page

    I assume the page type is just a Interface. Basic user does he part of document folder? .Can you tell us what's the error you are getting . Is it can't find document?? or is it error related to readingcsv file function??

     I don't have access to Appian Designer when being basic user

    That's because he isn't part of designer group. In Appian, Groups forms bridge between what a user sees and not.Basic user can see designer if he is part of designer group.

    You are basic user and still you are able to see and perform action in application because you are part of the Application Security groups.just like that  user needs at least editor access to upload a file to the document folder.  Object Security . 

    System Administrator bypasses all the securities. that's why he is able to perform the action.

    mollyn6512
    April 17, 2024

    I think the upload document action is having issue, I just rechecked. I created a page (interface) with the attached code above. Then when I use my basic user account to upload the file, I got local!uploadSuccess = false (local variable to check if the file has been uploaded successfully to appian folder - I can verify this by adding a richtext display section right under my quickUploadFile()). 

    I had added this basic user to the application all user group, which has viewer permission to the document folder. I'm I setting the security permission wrongly?

    mollyn6512
    April 17, 2024

    Update: File uploaded and be validated successfully if I give the basic user account administrator permission in my document folder. But is this the right action? because I don't want to allow basic users changing anything in my document folder. 

    gopalk2865
    Participating Frequently
    April 17, 2024

    You need to give basic user "Editor" permission for that folder not admin permission.

    harshk1671
    April 17, 2024

    Make sure the basic user has at least Editor access to the folder where documents are getting saved.