Browse Source

[useradmin] Add a view user page

Romain Rigaux 10 years ago
parent
commit
cc14254

+ 5 - 1
apps/metastore/src/metastore/templates/describe_table.mako

@@ -254,7 +254,11 @@ ${ assist.assistPanel() }
                     </h4>
                     <div class="row-fluid">
                       <div class="span6">
-                        <div title="${ _('Owner') }"><i class="fa fa-fw fa-user muted"></i> ${ table.details['properties'].get('owner') }</div>
+                        <div title="${ _('Owner') }">
+                          <a href="/useradmin/users/view/${ table.details['properties'].get('owner') }">
+                            <i class="fa fa-fw fa-user muted"></i> ${ table.details['properties'].get('owner') }
+                          </a>
+                        </div>
                         <div title="${ _('Created') }"><i class="fa fa-fw fa-clock-o muted"></i> ${ table.details['properties'].get('create_time') }</div>
                         <div title="${ _('Format') }"><i class="fa fa-fw fa-file-o muted"></i> ${ table.details['properties'].get('format') }</div>
                         <div title="${ _('Compressed?') }"><i class="fa fa-fw fa-archive muted"></i> ${ table.details['properties'].get('compressed') and _('Not compressed') or _('Compressed') }</div>

+ 0 - 3
apps/useradmin/src/useradmin/templates/layout.mako

@@ -72,9 +72,7 @@ def is_selected(section, matcher):
 </%def>
 
 
-
 <%def name="commons()">
-
   <link href="${ static('useradmin/css/useradmin.css') }" rel="stylesheet">
 
   <script type="text/javascript">
@@ -98,4 +96,3 @@ def is_selected(section, matcher):
     });
   </script>
 </%def>
-

+ 46 - 0
apps/useradmin/src/useradmin/templates/view_user.mako

@@ -0,0 +1,46 @@
+## Licensed to Cloudera, Inc. under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  Cloudera, Inc. licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+<%!
+from desktop.views import commonheader, commonfooter
+from django.utils.translation import ugettext as _
+%>
+
+<%namespace name="layout" file="layout.mako" />
+
+${ commonheader(_('Hue Users'), "useradmin", user) | n,unicode }
+${ layout.menubar(section='users') }
+
+<div class="container-fluid">
+  <div class="card card-small">
+    <h1 class="card-heading simple">${ _('User: %(username)s') % {'username': instance.username} }</h1>
+
+    <div class="steps">
+      <div id="step1" class="stepDetails">
+        ${ _('Username') } ${ instance.username }
+        <br/>
+        ${ _('First name') } ${ instance.first_name }
+        <br/>
+        ${ _('Last name') } ${ instance.last_name }
+        <br/>
+        ${ _('Email') } ${ instance.email }
+      </div>
+  </div>
+</div>
+
+
+${layout.commons()}
+
+${ commonfooter(messages) | n,unicode }

+ 1 - 0
apps/useradmin/src/useradmin/urls.py

@@ -28,6 +28,7 @@ urlpatterns = patterns('useradmin.views',
   url(r'^groups$', 'list_groups'),
   url(r'^permissions$', 'list_permissions'),
   url(r'^users/edit/(?P<username>%s)$' % (username_re,), 'edit_user'),
+  url(r'^users/view/(?P<username>%s)$' % (username_re,), 'view_user'),
   url(r'^users/add_ldap_users$', 'add_ldap_users'),
   url(r'^users/add_ldap_groups$', 'add_ldap_groups'),
   url(r'^users/sync_ldap_users_groups$', 'sync_ldap_users_groups'),

+ 7 - 0
apps/useradmin/src/useradmin/views.py

@@ -310,6 +310,13 @@ def edit_user(request, username=None):
     return render('edit_user.mako', request, dict(form=form, username=username))
 
 
+def view_user(request, username):  
+  instance = User.objects.get(username=username)
+
+  return render('view_user.mako', request, {'instance': instance})
+
+
+
 def edit_group(request, name=None):
   """
   edit_group(request, name = None) -> reply