For a University community for example.

  • riccardo
    link
    5
    edit-2
    3 years ago

    Total noob here but by browsing the sourcecode, I’ve found the function/regex that checks for the email correctness (permalink). I guess that by looking at the existing code and at the is_email_regex function, you can rather easily add an additional check to make sure the email is bound to the domain you want. No idea if this function/regex is the one the code actually tests email addresses against to check whether they are valid or not

    Edit: apparently that function is not used in the registration process, but in the login one. I’m totally cluelessly wandering across the code so someone please correct me if I’m wrong. Apparently the registration process is handled here. I think that if you add an additional check on the email address here, you can obtain the result you’re looking for

    Something like:

    lazy_static! {
      static ref UNI_REGEX: Regex =
        Regex::new(r"^.+@somedomain$").unwrap();
    }
    
    pub fn is_uni_regex(test: &str) -> bool {
      UNI_REGEX.is_match(test)
    }
    

    and then in the file I linked above:

    if !is_uni_regex(data.email) {
      return Err(APIError::err("unauthorized_email_domain").into());
    }
    

    …and you’d have to add a new unauthorized_email_domain key to the translations file. Again I hope I’m stressing it enough, do not trust me. There are probably more correct or consistent ways of doing it. I’m just trying to figure out by myself lol

    Edit again: as far as I remember, Lemmy doesn’t send any verification url to the user email, so one could just make up an email address using the required domain and the account would be valid

    Anyway yes, as AgreeableLandscape said, as long as you respect the AGPL license, you can do whatever you want to the public sourcecode, including adding this kind of verification

    • @usrOP
      link
      43 years ago

      Thanks! Yeah, I figured I would need to put some effort beyond a simple fix. Just more fun I guess :)

    • DessalinesMA
      link
      33 years ago

      Yup this is correct, it would be that easy.

  • @AgreeableLandscape
    link
    53 years ago

    To my knowledge, no mechanism currently exists in the backend codebase that allow administrators to do that, but the code is open source so, for example, a university wanting to set up a member-only instance can implement an email restriction themselves.

  • @nutomicA
    link
    43 years ago

    The “correct” solution for this would be something like LDAP or similar (which any sysadmin would surely prefer over this manual account creation). We have an open issue for that, but we would probably need help to implement it.

    • @usrOP
      link
      33 years ago

      I don’t think I could use LDAP, I’m not faculty or part of the IT department, sounds really useful tho.

      • @nutomicA
        link
        43 years ago

        Oh you want to do it as an unofficial forum for the university? Another option I can think of is making the signup page (and HTTP API endpoint) only available on the university network. But I dont know if its possible to block it on websocket.

  • Maya
    link
    33 years ago

    the other answers cover it but do you have a university in mind to make a Lemmy instance for? that sounds cool

    • @usrOP
      link
      7
      edit-2
      3 years ago

      A Chilean University, I’m thinking about this as a project after finals.

      • Maya
        link
        33 years ago

        Ah! Well, it looks like Lemmy doesn’t have any email verification built in (by design), so you’d need to figure that out first, and then the domain filter could be done pretty easily on top of that.

    • @nothuman@baraza.africa
      link
      fedilink
      23 years ago

      Why the students would be interested on Lemmy than an Whatsapp group? Including that they are suppose to use a specific domain.

      • @usrOP
        link
        43 years ago

        Well the university students and the ex-alumni range in the tens of thousands and a Whatsapp group caps at 255 users and becomes unusable at 100. Not to mention that a forum/reddit alternative covers a niche totally different from a chatroom.

        (also anonymity is a plus)

          • @usrOP
            link
            33 years ago

            Privacy != Anonymity, I may be a rando but I’m not the university administration nor is anyone gonna be called at 3:00 AM by some creep in the group.

            This is obviously just if people are that interested in the student-only shtick, I may just go vanilla.

            • @nothuman@baraza.africa
              link
              fedilink
              13 years ago

              You’re right, but if this would be official, the admins could report to the university a user sharing and Scihub link for example.

      • Maya
        link
        33 years ago

        upvoting memes? verification yet anonymity?

      • riccardo
        link
        23 years ago

        Almost impossible to keep a whatsapp group tidy and organized enough for the needs of an university. It’s hard to properly collect and index useful conversations. Topics get mixed all together. Chat history is local, if you loose your phone you might end up loosing the whole history. You are forced to share your phone number with people you might not even know or trust. You’re handing your metadata to Facebook.

        Lemmy would be a pretty cool tool to have, idk, subject-based or course-based communities that allow discussions to develop in comments forests. You can link stuff easily. You have mods moderating these communities which is not possible in whastapp (eg. can’t delete a useless or disturbing post for everyone). People can subscribe only to the topics they care about and are not forced to go through one shared chat history to find discussions they are interested in.

        I mean, in general, I find whatsapp groups to be good only for chit-chats. In the messaging world alone (so not considering “news aggregator” sites such as Lemmy) there are far better and friendly alternatives such as Discord, Mattermost, Element, Telegram, which allow a much more organized discussion to happen, with a good degree of moderation and indexing capabilities