Created
February 24, 2017 12:55
-
-
Save dz0/ea88090797f2ff4854c1a438763006db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def user_roles(): | |
| rows = db().select(db.auth_user.username, db.auth_group.ALL, | |
| left=[ | |
| db.auth_membership.on( db.auth_user.id == db.auth_membership.user_id), | |
| db.auth_group.on( db.auth_group.id == db.auth_membership.group_id) | |
| ] | |
| ) | |
| rows_grouped = rows.group_by_value( db.auth_user.username ) | |
| simple_grouped = {} | |
| for name in rows_grouped: | |
| simple_grouped[name] = ', '.join( | |
| [ | |
| row['auth_group']['role'] or '' # vietoj None bus '' | |
| for row in rows_grouped[name] | |
| ] | |
| ) | |
| # rows_grouped[name] = BEAUTIFY( rows_grouped[name] ) | |
| return CAT( SQLTABLE(rows), P("SUGRUPUOTA"), TABLE(map( TR, simple_grouped.items())), BEAUTIFY(rows_grouped ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment