Git Product home page Git Product logo

nc-userimporter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nc-userimporter's Issues

The script doesn't run

Hi,

I installed Python 3.9 and all required dependencies, and nc-userimport. After, i configured the config file and the CSV File.

But when, i launch the script, it doesn"t work. I have the following lines :

MacBook-Pro-M1:nc-userimporter toto$ ~/Library/Python/3.9/bin/pyinstaller --onefile nc-userimporter.py
115 INFO: PyInstaller: 5.13.0
115 INFO: Python: 3.9.6
124 INFO: Platform: macOS-13.4.1-arm64-arm-64bit
125 INFO: wrote /Users/toto/nc-userimporter/nc-userimporter.spec
127 INFO: Extending PYTHONPATH with paths
['/Users/toto/nc-userimporter']
219 INFO: checking Analysis
230 INFO: checking PYZ
234 INFO: EXE target arch: arm64
234 INFO: Code signing identity: None
235 INFO: checking PKG
236 INFO: Bootloader /Users/toto/Library/Python/3.9/lib/python/site-packages/PyInstaller/bootloader/Darwin-64bit/run
236 INFO: checking EXE
MacBook-Pro-M1:nc-userimporter toto$

Can you help me ?

Thanks

nc-userimporter doesn't work anymore

Hello everybody,

to import users into nextclud I tried the nc-userimporter. It worked fine for a day. The next day it stopped working. The following error message (see appendix) appears and the process aborts. I do not know why. I didn't change anything. Maybe someone has a tip for me.

Uli

Fehler

Feature-Request: Delete users from List

Deleting users is actually not in scope for this tool, since it's the nc-userIMPORTER. But it could be a useful feature for testing.

Alternatively we could modify the config.xml to accept custom API requests. Like this the tool could be used in any way: do [myRequest] for [myUserlist].

Adding Pages to Wiki

I'm very pleased with this utility, and would be happy to add a few notes based on my experience in the wiki. Would it make sense to open the wiki for public editing?

Thanks much for providing this to the NC community!

Enhancement: Add pdf-generation for administrator AND/OR each user

Current condition:
pdfonedoc only allows either <pdfonedoc>yes</pdfonedoc> OR <pdfonedoc>yes</pdfonedoc>

Target state:
Add parallel usage (logical gate "OR")

  • <pdfonedoc>yes</pdfonedoc>
  • <pdfonedoc>no</pdfonedoc>

of pdfonedoc (config.xml) for administrator + each user.

When acheiving target state, the nc-administrator will

  1. be supplied with a list of all users
  2. be supplied with a fileset of individual users' pdfs

Thanks in advance for consideration.

PS: Please tag @BenBo17 in your response if necessary. I am not very familiar with Github.

<sslverify>False</sslverify

hello so i am an ip based server and trying to run the importer...i did try and changed to False the sslverify but i still get the error
HTTPSConnectionPool(host='xxx.xxx.xxx', port=443): Max retries exceeded with url: /ocs/v1.php/cloud/groups?search=Lehrkraefte (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1056)')))

i did not change anything else part for what was needed to change since i want to test the existing file first and then add my own...
seems a problem with the ssl certification !!!

please someone pass me some knowledge :)

RESPONSE: failure 104 = group Kollegium does not exist

Hello, although all required groups are available in Nextcloud (Nextcloud Hub 7, version 28.0.3), I always get the error "failure 104 = group Kollegium does not exist"

This is also independent of which group / groups are specified.

I started this from a Windows 11 PC.

Changing default language to ...

Hi there,

thanks for your great script for creating new users.
It really saves me a lot of time.

Is there a possibility to change the language to e.g. german so that user get a email written in their preferred language. Is would be nice if this can be set for creating the pdf too.

By creating new users a group admin has to be defined.
I dont want users to be able to add new users or add groups within their admin group.
How can i achieve this?

Thanks for your advice :-)

NameError

When trying to run the script, I get the following error. I've double and triple checked the config.xml and csv, everything seems to be in order. Any insight?

Copyright (C) 2019-2020 Torsten Markmann (t-markmann), edudocs.org & uplinked.net
Contributors: Johannes Schirge (Shen), Nicolas Stuhlfauth (nicostuhlfauth)
This program comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it under certain conditions.
For details look into LICENSE file (GNU GPLv3).

Traceback (most recent call last):
File "nc-userimporter.py", line 84, in
File "", line 1, in
NameError: name 'false' is not defined
[10808] Failed to execute script nc-userimporter

Running on Windows 10 with the provided exe.

UnicodeDecodeError on import

Hi all!

I'm trying to use the script locally on the server and set the 'localhost' address in the config.xml. The script breaks on the first line of the CSV file:

HTTPSConnectionPool(host='localhost', port=443): Max retries exceeded with url: /ocs/v1.php/cloud/groups?search=CDI (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_record', 'wrong version number')])")))
The CURL request could not be performed.

although I've set False... It seems the script tries to force SSL connection. Can anyone provide a clue on this issue?

Thanks in advance for any help!

Import multiple times: overwrite or duplicate?

Hi Community,

I'm preparing a Nextcloud server for a friend (association) and work from home: the server is then connected to my LAN and cannot be used by the members.
I want to import the whole list of members, which I created with all real values, except the passwords but including members' email address. I'd like to import the list to create groups and so on, but DON'T WANT the members to be notified that their account is available. I could just delete all addresses as well: is it enough?

Then, once I returned the server to my friend, I'd like to perform a second import with all email addresses to trigger the email notification "Please connect and change your password": would it overwrite the existing users, as I expect, or would it duplicate the usernames and accounts?

Thanks in advance for your advises!

Program closes with big database

I tried out the program with a test user before starting the script with all the users. It worked just fine.
Afterwards I put in all the users data and tried to run the script again. After the first message and hitting ENTER as the [ANY KEY], the window just closes. In a previous issue (#41) you commented, that you should run it through a command prompt. The Error code now tells me, that the .csv file does not exist. But if I delete all users except the test user from the .csv file and save it the script runs completely fine again.
Do you have any idea how to fix this?

Special Character ( & ) sets other passwords

Hi,

If you have a csv list with preset passwords and a "&" is at the end the user does not get the pre-set password.
The Config.xml line 14 is set to no

With other preset passwords and charaters like ?;!;$ are working.

Script working except for the issue mentioned above. Date: 29/09/2022

curl unable to connect?

Hello,

I'm a newbie in administrating servers and nextcloud.
when I run the script, it reads properly the file and the configuration, but stops when the first user shourld be created.

The error msg is:

 HTTPSConnectionPool(host='yyyy.xxxxx.com', port=443): Max retries exceeded with url: /cloud/ocs/v1.php/cloud/groups?search=PCSI (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f655a4aea90>: Failed to establish a new connection: [Errno -2] Name or service not known'))
The CURL request could not be performed.

I first tried from my home PC, and then from the server using ssh: both failed.
Should I modify some settings in Nextcloud, is there a way to run it locally without having to go through curl/https?

Thanks for any help!

HTTPSConnectionPool SSL: CERTIFICATE_VERIFY_FAILED

When i using nc-userimporter.exe on windows following error came up:

HTTPSConnectionPool(host='censored', port=9443): Max retries exceeded with url: /ocs/v1.php/cloud/groups?search=censored (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)')))

I am using a buyed SSLCert. So its not self singed!

Can't connect on debian VM

Hello,

I would like some help to be able to connect nc-userimporter to my nextcloud on the same VM. I installed nextcloud on a debian 10 VM and try to import users from a csv file.
I saw you script and try it but when i edited the config.xml like this:

<cloudurl>127.0.0.1/nextcloud</cloudurl> <!-- CHANGE THIS to your cloud domain, e.g. mycloud.myd$
<adminname>alex</adminname> <!-- CHANGE THIS to your cloud user, who has admin permissions-->
<!-- Attention: Please note most special characters are not allowed in passwords, including germ$
    <adminpass>********</adminpass> <!-- CHANGE THIS to the password for that user -->
<!-- Attention: Please note some special characters are not allowed in passwords, avoid using ) $

i have this error:

    HTTPSConnectionPool(host='127.0.0.1', port=443): Max retries exceeded with url: /nextcloud/ocs/v1.php/cloud/groups?search=Lehrkraefte (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f1912082cc0>: Failed to establish a new connection: [Errno 111] Connection refused',))
     The CURL request could not be performed.

What can i do to solve that ?

Well cordially and thank you for your work.

"Invalid Quota Value 1 GB,,,,,,,,,,,,"

Hi,

I am trying to use this program to mass upload users into my nextcloud server. My only problem is that, occasionally, every single person I try to upload has a bunch of commas behind their Quota value even though I did not put it there. Sometimes this doesn't happen though, and I'm not sure what is causing it.

[SOLVED] Its possible to import with blank password and without welcome message?

Hi,
I could not figure out how to do that:
import without password and without welcome message?
How to configure the "config.xml" file?
If NO: an e-mail will be sent. (is not wanted)
<generatepassword>no</generatepassword> <!-- Select yes if you want a password to be generated automatically if no password is specified in user-csv-file. Select no if you want an e-mail to be sent to the user instead with a request to enter a password. In this case a correct e-mail address MUST be entered in the user-csv-file. -->

If YES: a password will be generated . (is not wanted)
<generatepassword>no</generatepassword> <!-- Select yes if you want a password to be generated automatically if no password is specified in user-csv-file. Select no if you want an e-mail to be sent to the user instead with a request to enter a password. In this case a correct e-mail address MUST be entered in the user-csv-file. -->

Thanks for answer.

App truncates servername

When the FQDN in the XML is something like space.rcsd.net the app errors claiming that it failed to make an HTTPS connection to (host='ace.rcsd.ne', port443)

It seems to truncate the first 1 or 2 characters and the last character. if I change it to space.rcsd.com, the error shows the host='ace.rcsd.com'.

For some reason it does not like names that begin with 'S', 'P', or end with "T'.

Any verbose mode?

Hi,
I've spent hours fixing minor errors in my config and data files but still cannot process through the script as I get an HTTP 502 error with the first data line. There isn't any logfile to help troubleshooting this, so I wonder if there's any verbose mode to force logfile feeding (notably with the HTTPS request which is sent around line 420).

By the way, my Nextcloud instance is sitting behind a Nginx reverse proxy: could this be an issue for the script? Pinging the server is OK though...

Thanks in advance for any help!

Problems with python3 and ubuntu

Dear Markmann,

thanks for your good job. I got problem running it on ubuntu with python3.6.
The module qrcode isn't available so i changed minor things to use the module pyqrcode.
First the import
import pyqrcode as qrcode
I commented the part of QR-Code class

# QR-Code class
#qr = qrcode.QRCode(
#    version=1,
#    error_correction=qrcode.constants.ERROR_CORRECT_L,
#    box_size=10,
#    border=4,
#)

and i changed the image creation for the pdf

    if response_xmlsoup.find('statuscode').string == "100":
      # generate qr-code
      url = qrcode.create("nc://login/user:" + row[0] + "&password:" + row[2] + "&server:https://" + config_ncUrl)     
      img = url.png(os.path.join( tmp_dir, row[0] + ".png" ), scale=6)
      #qr.clear()

and also the new file ending for the image afterwards (*jpg -> *.png)
im2 = Image(os.path.join( tmp_dir, row[0] + ".png" ), 200, 200)

Thanks for your work.
The whole file is attached.
nc-userimporter.py.zip
nc-userimporter.py.zip

Best wishes Johannes

Configuration option `generatepassword` does not work as expected

First of all: Thanks a lot for your work! This script has saved countless hours of adding users to our Nextcloud instance. 👍

We use the generatepassword configuration option (which is set to yes by default). Its documentation reads:

Select yes if you want a password to be generated automatically if no password is specified in user-csv-file.

However, the script was not creating passwords, but pointed out that the passwords from the users-csv-file did not have the proper length.

Upon closer inspection, we noticed these two lines:

  if not config_GeneratePassword == 'yes':
    print ("ATTENTION: You have specified that users for whom no password has been entered will receive an e-mail to set a password for themselves. [...]")

Finally, we were able to achieve the desired functionality by setting the configuration option to something other than yes.

Shouldn't the line 344 omit the not part?

Again, thanks for your effort! It's highly appreciated.

Importer doesn`t run

I have set up the config and csv file, when I run the importer it tells me to hit "any key" but nothing happens. If I hit "enter" on the keyboard the command line just closes.

nc user importer doesnt start on Windows

Hello,
I have a problem with the nc-user-import. It always stops with the following error message.
My system is on Windows 11 and I also start the .exe as administrator.

image

import user email

hi
I had no email when I import CSV

username;displayname;password;email;groups;subadmin;quota
101297601;Ethan;password;[email protected];group;;

the email was not import
thanks

Error while importing users

Hello. After I press "enter" to confirm the importing i receive the following error message:

When you are sure that your settings in the config.xml are correct,
press [ANY KEY] to continue.
Otherwise, press [CONTROL + C] to abort the process.

They have decided to continue. A user import preview is generated.

Traceback (most recent call last):
  File "nc-userimporter.py", line 328, in <module>
  File "c:\users\tm\appdata\local\programs\python\python37\lib\codecs.py", line 714, in __next__
  File "c:\users\tm\appdata\local\programs\python\python37\lib\codecs.py", line 645, in __next__
  File "c:\users\tm\appdata\local\programs\python\python37\lib\codecs.py", line 558, in readline
  File "c:\users\tm\appdata\local\programs\python\python37\lib\codecs.py", line 504, in read
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdf in position 0: invalid continuation byte
[7392] Failed to execute script nc-userimporter

There are no ö,ä or ü in the user list.
I also noticed that the file path in the error message doesn't match with my windows user name.
In february i ran the script for another nextcloud instance and it worked perfectly fine. So it can't be a dependency problem.

Ben

Feature-Request: Synchronizing the user database with a csv file

It would be great if the script would check and execute the following:

  1. Check if a username already exists
    1a) If no, create a new one.
    1b) If yes, ask if the user should be updated (group membership, etc.).

  2. Check whether a user name that does not exist in the .csv file can be found in the NC database.
    2a) Ask if the user should be deleted and if yes, delete it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.