How do you give users access to statistics based on confidential data without giving them access to the documents themselves?
I soleved the problem using Lotus Notes method for the domino agent class RunOnServer.
An HR manager wanted to know how many days were taken off due to illness in a certain month, but was not allowed to see the actual personal data ie who took the days off and the reasons why.
Now as the developer I could just run the report and print off the data for the user when they required, but I want to develop not be a report writer!
Here is the technique: You have an agent that does the searching and collating of data which has the top access rights and so has access to the documents.
The user who has an [HR] role is able to submit request documents for different statistics:
Days off per month by reasons: cold, back ache, sports injuries etc
The agent is then run on the server and the results are emailed to the HR user.
This worked fine, in fact it had advantages as we now had a log of who was requesting these reports.
The only problem was that the user's machine was held up while the runonserver request was running. if this was a big request such as year stats then this could take a few minutes which of course is not desirable.
The solution was to invoke an intermediate agent that actually ran the agent.
So the code in the submit button on the request was:
@postedCommand([FileSave]);
@postedCommand([FileCloseWindow]);
@postedCommand([ToolsRunMacro]; "(StartRequestAgentOnServer)" );
This Start Request Agent then had the code:
Dim s as new notessession
dim db a snotesdatabase
set db = s.currentdatabase
dim a as notesagent
set a = db.getagent("(ProcessReportRequests)")
if a is nothing then
Messagebox "Cannot load ProcessReportRequests Agent. Contact notes team."
end
end if
call a.runonserver()
Print "Report request submitted. The report should arrive in your email box in a few minutes."
The ProcessReportsRequests agent then was signed with the full Admin rights id and had access to all of the data.
The Notes Agent finds all Requests with status="Awaiting Processing", changes the status="In Progress", runs the report and changes the status to "Processed" or "Error" and sends an email to the developer if there is an error or to the user if it runs ok.
NB: You cannot runonserver an agent that is scheduled. See http://www.NotesNinjas.com/#RunOnServerBug
FYI: Another discussion on using RunOnServer: Andrew Pollack's Vision for Hire that uses notessession method SendConsoleCommand to interact with the server.