Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Add users in bulk via spreadsheet or link

    Support
    usermanagement
    6
    10
    314
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      ntnsndr last edited by girish

      I am using Cloudron to manage a university class with 250+ students. I wonder if there is a way to easily add all the students to a specific group, without having to add them manually one by one. For instance, can I:

      • Send them a magic link that they can use to create a new account in a given group?
      • Import them via a csv file or the like?

      Thanks for your help.

      girish jdaviescoates BrutalBirdie 4 Replies Last reply Reply Quote 2
      • girish
        girish Staff @ntnsndr last edited by

        @ntnsndr yes, this is coming in the next release as part of the import/export feature - https://forum.cloudron.io/topic/5982/what-s-coming-in-cloudron-7-1 🙂

        1 Reply Last reply Reply Quote 2
        • girish
          girish Staff @ntnsndr last edited by

          @ntnsndr said in Add users in bulk via spreadsheet or link:

          Send them a magic link that they can use to create a new account in a given group?

          this part might have to be automated via some curl calls though. Maybe we can add a "checkbox" in the import UI to invite users as well (cc @nebulon )

          1 Reply Last reply Reply Quote 1
          • jdaviescoates
            jdaviescoates @ntnsndr last edited by

            @ntnsndr said in Add users in bulk via spreadsheet or link:

            Send them a magic link that they can use to create a new account in a given group?

            This would be awesome.

            I use Cloudron with Gandi & Hetzner

            1 Reply Last reply Reply Quote 0
            • BrutalBirdie
              BrutalBirdie Staff @ntnsndr last edited by BrutalBirdie

              Here is what I did once for ~200 Users which I also had in a CSV. Converted the CSV to JSON.

              Python

              import json
              from pprint import pprint
              import requests
              
              data = [
                {
                  "Surname": "Testing",
                  "Name": "Tina",
                  "Login": "tina.testing",
                  "Mail": "tina.testing@domain.tld",
                  "Password": "_SUPER_SECURE_CLEAR_TEXT_PASSWORD_"
                }
              ]
              
              url="https://my.DOMAIN.TLD/api/v1/users"
              
              headers = {
                  "Content-Type": "application/json",
                  "Authorization": "Bearer CLOUDRON_API_TOKEN"
                  }
              
              for value in data:
                  values= {
                      "email": value["Mail"],
                      "displayName": f'{value["Name"]} {value["Surname"]}',
                      "role": "user",
                      "username": value["Login"],
                      "password": value["Password"],
                      "admin": False
                  }
                  jdata = json.dumps(values)
                  try:
                      # pprint(data)
                      r = requests.post(url, data=jdata, headers=headers)
                  except Exception as e:
                      pprint(e)
              
              

              I had no need for group mapping that is why the group user is hard coded and not mapped from the values.

              If you can convert your CSV to fit JSON Object required for the request it should be even easier.

              {
                  "email": "jjnTB@eOvbuuolIyPahhKbpYAXiYncqvbIQQ.tl",
                  "username": "cillum do dolore cupidatat",
                  "displayName": "in dolore Lorem",
                  "password": "nostrud Ut dolor consectetur",
                  "admin": false
              }
              

              https://docs.cloudron.io/api.html#tag/Users/paths/~1users/post

              Like my work? Consider donating a beer 🍻 Cheers!

              BrutalBirdie 2 Replies Last reply Reply Quote 3
              • BrutalBirdie
                BrutalBirdie Staff @BrutalBirdie last edited by

                While at the topic 😄 When you got A LOT of users it can become a pain to manage them.
                Example if you want to create a Mailbox and then have to scroll threw ALL 200 Users to find the correct one, since there is no search.

                Like my work? Consider donating a beer 🍻 Cheers!

                robi girish 2 Replies Last reply Reply Quote 3
                • robi
                  robi @BrutalBirdie last edited by robi

                  @brutalbirdie same for domains, email and most other UI features. Although a browser based search can be used to jump to the relevant parts via CTRL-F.

                  Life of Advanced Technology

                  1 Reply Last reply Reply Quote 1
                  • girish
                    girish Staff @BrutalBirdie last edited by

                    @brutalbirdie doesn't users and mailboxes UI both have a search?

                    fbartels 1 Reply Last reply Reply Quote 2
                    • fbartels
                      fbartels App Dev @girish last edited by

                      @girish i would say so as well. For mailbox ownership and group membership there is a "filter" element.

                      1 Reply Last reply Reply Quote 2
                      • BrutalBirdie
                        BrutalBirdie Staff @BrutalBirdie last edited by

                        huh for some reason in my last session I did not see the search field but there is one. (Maybe I was just blind 🤷)

                        094213ff-47fe-41f3-b452-a341a216719f-grafik.png

                        I take it back, please don't throw stones 😄

                        Like my work? Consider donating a beer 🍻 Cheers!

                        1 Reply Last reply Reply Quote 2
                        • First post
                          Last post
                        Powered by NodeBB