Modify

Opened 8 years ago

Last modified 3 years ago

#5191 assigned defect

[Patch] New users do not appear in members-list

Reported by: anonymous Owned by: Ryan J Ollos
Priority: normal Component: SvnAuthzAdminPlugin
Severity: normal Keywords: user list
Cc: dmcr@… Trac Release: 0.11

Description

After adding a few new users with the accountmanagers plugin these new users do not appear in the list of groupsmembers in the svnauthz plugin.

Attachments (0)

Change History (13)

comment:1 Changed 8 years ago by anonymous

Component: SELECT A HACKSvnAuthzAdminPlugin
Owner: changed from anonymous to Kis Gergely

comment:2 Changed 8 years ago by anonymous

Type: enhancementdefect

comment:3 Changed 8 years ago by Chris Heller

The list of users that is shown comes from the list of users (or groups) in Trac that have been assigned at least one permission.

So, if you want to give one person specific access in svn authz, they need to have at least one permission explicitly granted to them in the Trac permissions; they can't have their only permissions come from Trac group membership.

comment:4 Changed 8 years ago by rupert thurner

added comment to #4832. see also here for the implementation to get all users.

comment:5 Changed 8 years ago by Jay Xie

This's my solution to get all users from session, this will list all users that exists in the session table in the trac database.

I don't think this is the best way, but it works for me.

  • svnauthz/admin_ui.py

     
    310310
    311311    def _get_all_users(self):
    312312      """
    313       Fetches all users/groups from PermissionSystem
     313      Fetches all users/groups from session
    314314      """
    315       perm = PermissionSystem(self.env)
     315      db = self.env.get_db_cnx()
     316      cursor = db.cursor()
     317      cursor.execute("SELECT sid "
     318                     "FROM session "
     319                     "WHERE authenticated=1")
    316320      users = ["*"]
    317       data = perm.get_all_permissions()
    318       if not data:
    319         return [] # we abort here
     321      for username in cursor:
     322        users.append(username)
     323      return users
    320324
    321       for (subject, action) in data:
    322         if subject not in users and subject not in ["anonymous", "authenticated"]:
    323           users.append(subject)
    324       return users
    325 
    326325    def _get_candidate_subjects(self, not_in_list = []):
    327326        candidates = []
    328327        users = [user for user in self._get_all_users()

comment:6 Changed 8 years ago by till

my proposal:

  • svnauthz/

    old new  
    310310
    311311    def _get_all_users(self):
    312312      """
    313       Fetches all users/groups from PermissionSystem
     313      Fetches all users/groups
    314314      """
    315       perm = PermissionSystem(self.env)
    316315      users = ["*"]
    317       data = perm.get_all_permissions()
     316      data = self.env.get_known_users()
    318317      if not data:
    319318        return [] # we abort here
    320319
    321       for (subject, action) in data:
     320      for (subject, name, email) in data:
    322321        if subject not in users and subject not in ["anonymous", "authenticated"]:
    323322          users.append(subject)
    324323      return users 

comment:7 in reply to:  6 Changed 7 years ago by Tim Niemueller

I'm using the patch from comment 6. Works just fine and is really useful e.g. when using the account manager plugin and most users do not have special permissions. I'd vote for applying it (and please make a release to ease packaging).

comment:8 Changed 7 years ago by anonymous

I'm using the patch in comment 7 posted by till and it works perfectly. Makes more sense as well as there's no guarantee that a user will be in the session table.

comment:9 Changed 6 years ago by Ryan J Ollos

Patch in comment:6 looks correct. Any objects by kisg that I commit this patch?

comment:10 Changed 6 years ago by Ryan J Ollos

Summary: New users do not appear in members-list[Patch] New users do not appear in members-list

comment:11 in reply to:  9 ; Changed 6 years ago by Steffen Hoffmann

Keywords: user list added

Replying to rjollos:

Patch in comment:6 looks correct. Any objects by kisg that I commit this patch?

Anonymous in comment:8 seems reminds me of the temporary nature of the session table (autopurge after some time of inactivity), while self.env.get_known_users() will take information from session_attribute table, that is guaranteed to last. Just my 2 ct.

comment:12 in reply to:  11 Changed 6 years ago by Ryan J Ollos

Cc: dmcr@… added; anonymous removed

Replying to hasienda:

Anonymous in comment:8 seems reminds me of the temporary nature of the session table (autopurge after some time of inactivity), while self.env.get_known_users() will take information from session_attribute table, that is guaranteed to last. Just my 2 ct.

I went ahead and pushed the changes from Dennis in #8165 since kisg seems to have disappeared. I'm thinking we have enough positive feedback to apply this patch as well.

comment:13 Changed 3 years ago by Ryan J Ollos

Owner: changed from Kis Gergely to Ryan J Ollos
Status: newassigned

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Ryan J Ollos.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.