These are chat archives for PaperCutSoftware/PaperCutExamples

19th
Jul 2016
Alec Clews
@alecthegeek
Jul 19 2016 03:10
I just wrote a test script to display all the paramters passed by PaperCut
#!/bin/sh

echo "$@" >> $0.log

and got the result

- all-users
- all-groups

when I hit the test button

francispvps
@francispvps
Jul 19 2016 05:09
hmmm... not sure why im getting just dash("-"). Im using C# and I assume it is simply being passed to the main argument array static void Main(string[] args) just like in C
Alec Clews
@alecthegeek
Jul 19 2016 05:43
I have posted a simple Python script to show the type of thing PaperCutSoftware/PaperCutExamples@c2cf19d
it's not a complte example because I'm short of time, but it should tell you what you need to know
francispvps
@francispvps
Jul 19 2016 05:58
yes pretty much same idea as what i did..though i havent added all the options. just "is-valid" and "all-users"
Alec Clews
@alecthegeek
Jul 19 2016 05:58
The Python script I wrote worked for me. Not sure why you are having problems
If you have Python 3 on your dev system you can test my version
Alec Clews
@alecthegeek
Jul 19 2016 06:10
I got the following result when I hit the test button in PaperCut
Starting Testing sync settings ... 
Synchronization process starting 
Retrieving users from the operating system (may take a while on large networks)... 
Synchronization complete. Operation took 0 seconds. 

A real operation would add 3 user(s) and if the "delete users" option was selected, would delete 13 user(s). 

Current settings produced a total of 3 users. 
The following is a list of the first 25 users. The format is: username, full name (optional), email (optional), card no (optional) 
ahmed/ahmed yakubb/ahmedy@here.com/marketing/home office/4321 
jane/jane rodgers/jhanr@here.com/sales/docklands/5678 
john/john smith/johns@here.com/accounts/melbourne/1234 


Current settings produced a total of 2 groups. 
The following is a list of the first 25 groups. 
groupA 
groupB 

Finished.
francispvps
@francispvps
Jul 19 2016 06:18
i get this from papercut aswell but only when I expose my list and not use any of the switches or just the dash
francispvps
@francispvps
Jul 19 2016 06:32
This message was deleted
blob
thats how it looks like on my end using 2 test users
Alec Clews
@alecthegeek
Jul 19 2016 06:33
"I expose my list and not use any of the switches or just the dash"
francispvps
@francispvps
Jul 19 2016 06:33
also figured that fields has to be separated by tabs (\t) and not by slashes (/)
Alec Clews
@alecthegeek
Jul 19 2016 06:34
Oops
francispvps
@francispvps
Jul 19 2016 06:34
yes that screenshot is the result from my end without using any of the switches... just
Alec Clews
@alecthegeek
Jul 19 2016 06:35
Please look at my code again
Now I use tabs I get a better result.
Starting Testing sync settings ... 
Synchronization process starting 
Retrieving users from the operating system (may take a while on large networks)... 
Synchronization complete. Operation took 0 seconds. 

A real operation would add 3 user(s) and if the "delete users" option was selected, would delete 13 user(s). 

Current settings produced a total of 3 users. 
The following is a list of the first 25 users. The format is: username, full name (optional), email (optional), card no (optional) 
ahmed, Ahmed Yakubb, ahmedy@here.com 
jane, Jane Rodgers, jhanr@here.com 
john, John Smith, johns@here.com 


Current settings produced a total of 2 groups. 
The following is a list of the first 25 groups. 
groupA 
groupB 

Finished.
PaperCut passes the switches and arguments. Your code processes them
What value do you have in the "Custom user program" field? Mine is /Users/alec/PaperCut/PaperCutExamples/Authentication/customUser.py
francispvps
@francispvps
Jul 19 2016 06:41
wait let me check
the path i have is connected to my application
\VPSCampusUsers\bin\Debug\VPSCampusUsers.exe
Alec Clews
@alecthegeek
Jul 19 2016 06:43
So what happens when you run \VPSCampusUsers\bin\Debug\VPSCampusUsers.exe - all-users from the commnd prompt?
francispvps
@francispvps
Jul 19 2016 06:45
if I set my program to use the switch "all-users" ... the users gets displayed
Alec Clews
@alecthegeek
Jul 19 2016 06:45
I don't undertand the phrase "if I set my program to use the switch "
francispvps
@francispvps
Jul 19 2016 06:45
but my point is "all-users" is not being passed by PC when pressing Test Settings
Alec Clews
@alecthegeek
Jul 19 2016 06:45
It does for me
francispvps
@francispvps
Jul 19 2016 06:45
ok ill explain
ok ill modify my code so that it will expose whatever is being passed by Test Settings...
Alec Clews
@alecthegeek
Jul 19 2016 06:46
Your program must process 2 arguments - and all-users
francispvps
@francispvps
Jul 19 2016 06:46
then ill screenshot...
i understand that and that was my initial design... until I realize PC is not actually passing "all-users"
Alec Clews
@alecthegeek
Jul 19 2016 06:47
Oh yes it is
I have proved it on my Mac today
francispvps
@francispvps
Jul 19 2016 06:47
i know it should... so i must be missing something... ill modify my code and show you what it is passing
or maybe im not capturing it correctly
Alec Clews
@alecthegeek
Jul 19 2016 06:49
We also have this program call being used in large sites in Mexico and other places. It works for sure
francispvps
@francispvps
Jul 19 2016 06:56
ok this is my bad
i can see "all-user" now
Alec Clews
@alecthegeek
Jul 19 2016 06:57
Cool
francispvps
@francispvps
Jul 19 2016 06:57
my string read was just reading the first index arg[0]
"all-user" was in arg[1]
Alec Clews
@alecthegeek
Jul 19 2016 06:57
Yup.
francispvps
@francispvps
Jul 19 2016 06:58
the c sample was taking literal 2 parameters...the c# console app, can take multiples
anyway thanks...do I have to build all the functions? like "all-groups" etc...
Alec Clews
@alecthegeek
Jul 19 2016 06:59
See my sample python code
francispvps
@francispvps
Jul 19 2016 06:59
yeah I can use that as guide... just cant run it for now... needs more config on python
Alec Clews
@alecthegeek
Jul 19 2016 06:59
I don't suggest trying to clone our UNIX example
francispvps
@francispvps
Jul 19 2016 06:59
for windows
no i cant clone even if I want to... doesnt run properly on windows box
im translating code to c# native
was hoping to do it in java but not sure if PC can run JAR file from this... coz document says should be EXE
Alec Clews
@alecthegeek
Jul 19 2016 07:02
You can wrap it in a script
However Java is probably a really bad choice because of the overhead of starting a JVM each time
francispvps
@francispvps
Jul 19 2016 07:03
i see
Alec Clews
@alecthegeek
Jul 19 2016 07:04
I would use a compiled language, so Go or C. But that's me
francispvps
@francispvps
Jul 19 2016 07:06
i understand. I chose c# coz visual studion can immediately build as console EXE... not need extra 3rd party packagers
boss is fixed in having this run on windows box anyway
Alec Clews
@alecthegeek
Jul 19 2016 07:14
Sure -- no idea what the startup performance of a CLI managed application is
francispvps
@francispvps
Jul 19 2016 07:21
ok
francispvps
@francispvps
Jul 19 2016 09:17
Hey Alec I have a quick question regarding these sections:
blob
is that where we place our smartcard numbers for smartcard authentication?
Alec Clews
@alecthegeek
Jul 19 2016 10:33
yes
Alec Clews
@alecthegeek
Jul 19 2016 13:36
YOu can also use the web services API
Alec Clews
@alecthegeek
Jul 19 2016 23:57

I've updated my sample code. It should cover all cases now

PaperCutSoftware/PaperCutExamples@61e5c1a