Bläddra i källkod

HUE-5057 [metadata] Skeleton to have tags in read only mode

Allow write by default.
Romain Rigaux 9 år sedan
förälder
incheckning
cea2c58ab9

+ 2 - 2
desktop/core/src/desktop/conf.py

@@ -23,6 +23,8 @@ import stat
 
 from django.utils.translation import ugettext_lazy as _
 
+from metadata.metadata_sites import get_navigator_audit_log_dir, get_navigator_audit_max_file_size
+
 from desktop.redaction.engine import parse_redaction_policy_from_file
 from desktop.lib.conf import Config, ConfigSection, UnspecifiedConfigSection,\
                              coerce_bool, coerce_csv, coerce_json_dict,\
@@ -30,8 +32,6 @@ from desktop.lib.conf import Config, ConfigSection, UnspecifiedConfigSection,\
                              coerce_password_from_script
 from desktop.lib.i18n import force_unicode
 from desktop.lib.paths import get_desktop_root
-from metadata.metadata_sites import get_navigator_server_url, get_navigator_audit_log_dir, \
-                                    get_navigator_audit_max_file_size
 
 
 LOG = logging.getLogger(__name__)

+ 1 - 3
desktop/core/src/desktop/templates/assist.mako

@@ -29,11 +29,9 @@ from metadata.conf import has_navigator
   <%namespace name="nav_components" file="/nav_components.mako" />
 
   ${ sqlContextPopover.sqlContextPopover() }
-  ${ nav_components.nav_tags() }
+  ${ nav_components.nav_tags(readOnly=not user.has_hue_permission(action="write", app="metadata")) }
 
   <style>
-
-
     .assist-icon {
       width: 16px;
       height: 16px;

+ 1 - 1
desktop/libs/metadata/src/metadata/conf.py

@@ -63,7 +63,7 @@ def get_navigator_url():
 
 def has_navigator(user):
   return bool(get_navigator_url() and NAVIGATOR.AUTH_PASSWORD.get()) \
-   and user.is_superuser or user.has_hue_permission(action="access", app=DJANGO_APPS[0])
+      and user.is_superuser or user.has_hue_permission(action="access", app=DJANGO_APPS[0])
 
 
 OPTIMIZER = ConfigSection(

+ 1 - 1
desktop/libs/metadata/src/metadata/navigator_client.py

@@ -153,7 +153,7 @@ class NavigatorApi(object):
 
         filterQueries += ['{!tag=type} %s' % ' OR '.join(['type:%s' % fq for fq in fq_type])]
 
-      search_terms = [term for term in query_s.strip().split()]
+      search_terms = [term for term in query_s.strip().split()] if query_s else []
       query = []
       for term in search_terms:
         if ':' not in term:

+ 6 - 1
desktop/libs/metadata/src/metadata/settings.py

@@ -15,8 +15,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-DJANGO_APPS = [ "metadata" ]
+DJANGO_APPS = ["metadata"]
 NICE_NAME = "Metadata"
 REQUIRES_HADOOP = False
 MENU_INDEX = -1
 IS_URL_NAMESPACED = True
+
+
+PERMISSION_ACTIONS = (
+  ("write", "Allow edition of metadata like tags."),
+)