1. Panayiotis Lipiridis
  2. gae-init-pro

Commits

Panayiotis Lipiridis  committed 07f6fd3 Merge

Merged gae-init/gae-init into default

  • Participants
  • Parent commits 23a0fe0, fa3cc41
  • Branches default

Comments (0)

Files changed (5)

File Gruntfile.coffee

View file
     grunt.loadNpmTasks('grunt-contrib-watch')
     grunt.registerTask('default', ['watch'])
     grunt.loadNpmTasks('grunt-bower-task')
-

File main/modelx.py

View file
 
 
 class UserX(object):
+  def has_permission(self, perm):
+    return self.admin or perm in self.permissions
+
   def avatar_url_size(self, size=None):
     return '//gravatar.com/avatar/%(hash)s?d=identicon&r=x%(size)s' % {
         'hash': hashlib.md5(self.email or self.username).hexdigest(),
         'size': '&s=%d' % size if size > 0 else '',
       }
   avatar_url = property(avatar_url_size)
-
-  def has_permission(self, perm):
-    return self.admin or perm in self.permissions

File main/templates/user/user_list.html

View file
               # if current_user.id == user_db.key.id()
                 <i class="fa fa-hand-o-left" title="You"></i>
               # endif
-              # if user_db.admin
-                <i class="fa fa-cog" title="Admin"></i>
-              # endif
-              # if not user_db.active
-                <i class="fa fa-ban" title="Inactive"></i>
-              # endif
             </td>
             <td>{{user_db.username}}</td>
             <td>{{user_db.email}}</td>
               </time>
             </td>
             <td>
+              # if user_db.admin
+                <a href="{{update_query_argument('admin', True)}}" class="label label-danger" title="More like God"><i class="fa fa-cog"></i> admin</a>
+              # endif
+              # if not user_db.active
+                <a href="{{update_query_argument('active', False)}}" class="label label-default" title="Can't sign in"><i class="fa fa-ban"></i> inactive</a>
+              # endif
               # for permission in user_db.permissions
-                <a href="{{update_query_argument('permissions', permission, list=True)}}" class="label label-info">{{permission}}</a>
+                <a href="{{update_query_argument('permissions', permission)}}" class="label label-info">{{permission}}</a>
               # endfor
             </td>
             <td class="text-nowrap">{{utils.auth_icons(user_db.auth_ids)}}</td>

File main/templates/user/user_merge.html

View file
         <table class="table table-bordered table-hover">
           <thead>
             <tr class="text-nowrap">
-              <th class="col-xs-4">Name</th>
-              <th class="col-xs-3">Username</th>
-              <th class="col-xs-3">Email</th>
-              <th class="col-xs-2">Created <i class="fa fa-chevron-up"></i></th>
+              <th class="col-xs-3">Name</th>
+              <th class="col-xs-2">Username</th>
+              <th class="col-xs-2">Email</th>
+              <th class="col-xs-2">Created <i class="fa fa-chevron-up text-muted"></i></th>
+              <th class="col-xs-3">Permissions</th>
               <th class="text-center" title="Accounts"><i class="fa fa-key"></i></th>
             </tr>
           </thead>
                   # if current_user.id == user_db.key.id()
                     <i class="fa fa-hand-o-left" title="You"></i>
                   # endif
-                  # if user_db.admin
-                    <i class="fa fa-cog" title="Admin"></i>
-                  # endif
-                  # if not user_db.active
-                    <i class="fa fa-ban" title="Inactive"></i>
-                  # endif
                 </td>
                 <td>{{user_db.username}}</td>
                 <td>{{user_db.email}}</td>
                     {{user_db.created.strftime('%Y-%m-%d')}}
                   </time>
                 </td>
+                <td>
+                  # if user_db.admin
+                    <span class="label label-danger" title="More like God"><i class="fa fa-cog"></i> admin</span>
+                  # endif
+                  # if not user_db.active
+                    <span class="label label-default" title="Can't sign in"><i class="fa fa-ban"></i> inactive</span>
+                  # endif
+                  # for permission in user_db.permissions
+                    <span class="label label-info">{{permission}}</span>
+                  # endfor
+                </td>
                 <td class="text-nowrap">{{utils.auth_icons(user_db.auth_ids)}}</td>
               </tr>
             # endfor

File main/user.py

View file
   if flask.request.path.startswith('/_s/'):
     return util.jsonify_model_dbs(user_dbs, more_cursor)
 
+  permissions = list(UserUpdateForm._permission_choices)
+  permissions += util.param('permissions', list) or []
   return flask.render_template(
       'user/user_list.html',
       html_class='user-list',
       user_dbs=user_dbs,
       more_url=util.generate_more_url(more_cursor),
       has_json=True,
-      permissions=sorted(UserUpdateForm._permission_choices),
+      permissions=sorted(set(permissions)),
     )