3
$\begingroup$

Can I associate a submitted FormFunction data with a user ( by $WolframID or whatever)?

It can be restricted to the case where "Permissions" to execute are given to the list of users or to "Authenticated" users. E.g.:

CloudDeploy[
 FormFunction[{"first" -> "String"}, $WolframID &]
 ,
 Permissions -> {"Authenticated" -> "Execute"}
]

Here $WolframID will evaluate to the ID of the account where the CloudObject is.

$\endgroup$
  • 2
    $\begingroup$ What about $RequesterWolframID? $\endgroup$ – C. E. Jun 22 '16 at 14:13
  • $\begingroup$ @C.E. That I have missed. Consider voting to close or posting an answer, up to you :) $\endgroup$ – Kuba Jun 22 '16 at 14:18
  • 3
    $\begingroup$ @Kuba -- For my part I think you've asked a good and useful question. We can't expect everyone to keep the entire contents of the documentation and their applications in their heads. $\endgroup$ – Jagra Jun 22 '16 at 14:49
  • $\begingroup$ @Kuba I didn't know what to do, luckily someone else posted so now it's up to others to decide what to do. $\endgroup$ – C. E. Jun 22 '16 at 18:30
1
$\begingroup$

You may be looking for something like:

CloudDeploy[
   FormFunction[formspec,
      If[$RequesterWolframID === None,
         HTTPResponse[ExportForm["Please login ...", "JSON"], <|"StatusCode"->403|> ],
         processformfunctioninput]& ],
    FileNameJoin[{$CloudRootDirectory,"RequireAuthentication"}] ]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.