Esempio n. 1
0
    def __init__(self, username):
        self._user = srusers.user(username)
        if not self._user.in_db:
            raise Exception("user '%s' does not exist in database" % (username))

        # cache any groups we change, since searching the database for them
        # after our changes will yield very odd results.
        self._modified_groups = set()
Esempio n. 2
0
    def __init__(self, username):
        self._user = srusers.user(username)
        if not self._user.in_db:
            raise Exception("user '%s' does not exist in database" %
                            (username))

        # cache any groups we change, since searching the database for them
        # after our changes will yield very odd results.
        self._modified_groups = set()
Esempio n. 3
0
    def __init__(self, username, password):
        # check their password
        user = srusers.user(username)
        assert user.bind(password)

        # Call parent init, which will, among other things, ensure that the
        # LDAP binding goes back to being via the manager credential, not the
        # one we just checked above.
        super(AuthenticatedUser, self).__init__(username)

        self._viewable_users_cache = set()
Esempio n. 4
0
    def __init__(self, username, password):
        # check their password
        user = srusers.user(username)
        assert user.bind(password)

        # Call parent init, which will, among other things, ensure that the
        # LDAP binding goes back to being via the manager credential, not the
        # one we just checked above.
        super(AuthenticatedUser, self).__init__(username)

        self._viewable_users_cache = set()
Esempio n. 5
0
    def create_new_user(cls, requesting_user, college, first_name, last_name):
        if not requesting_user.can_register_users:
            raise Exception("requesting user '%s' is not permitted to create new users" % (requesting_user.username))

        if not college in requesting_user.colleges:
            raise Exception("requesting user '%s' is not in the requested college '%s'" % (requesting_user.username, college))

        username = srusers.new_username(college, first_name, last_name)
        u = srusers.user(username)
        u.cname = first_name
        u.sname = last_name
        u.email = ''
        u.save()
        return User(username)
Esempio n. 6
0
    def create_new_user(cls, requesting_user, college, first_name, last_name):
        if not requesting_user.can_register_users:
            raise Exception(
                "requesting user '%s' is not permitted to create new users" %
                (requesting_user.username))

        if not college in requesting_user.colleges:
            raise Exception(
                "requesting user '%s' is not in the requested college '%s'" %
                (requesting_user.username, college))

        username = srusers.new_username(college, first_name, last_name)
        u = srusers.user(username)
        u.cname = first_name
        u.sname = last_name
        u.email = ''
        u.save()
        return User(username)
Esempio n. 7
0
 def can_authenticate(cls, username, password):
     return password is not None and srusers.user(username).bind(password)
Esempio n. 8
0
 def can_authenticate(cls, username, password):
     return password is not None and srusers.user(username).bind(password)
Esempio n. 9
0
 def password_correct(self):
     return self.request_has_password and srusers.user(self.form["username"]).bind(self.form["password"])
Esempio n. 10
0
 def password_correct(self):
     return self.request_has_password and srusers.user(self.form["username"]).bind(self.form["password"])
Esempio n. 11
0
        data["feed"] = info
        json.dump(data, fp)


if len(sys.argv) != 3:
    print "Usage: convert.py path/to/blog-feeds.json path/to/team-status-folder"
    exit(1)

filePath = sys.argv[1]
statusPath = sys.argv[2]

print "Converting %s." % filePath

data = None
with open(filePath) as fp:
    data = json.load(fp)

# print data

for entry in data:
    # 	print entry
    uid = entry["user"]
    user = sr.user(uid)
    # 	print user
    for group in user.groups():
        if group[: len(TEAM_PREFIX)] == TEAM_PREFIX:
            tid = group[len(TEAM_PREFIX) :]
            print "Adding value to %s." % tid
            statusFilePath = os.path.join(statusPath, tid + STATUS_POSTFIX)
            putUrlInStatus(entry, statusFilePath)