Commit 62305f52 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Refactoriza y limpia valores de rol

parent b04a3287
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ define([
				privatePdf = data.privateInternalUrl,
				result = '';

			if (!(!pdfUrl || (privatePdf && Credentials.get('userRole') !== 'ROLE_ADMINISTRATOR'))) {
			if (pdfUrl && (!privatePdf || Credentials.userIsEditor())) {
				if (privatePdf) {
					result = '<i title="' + i18n.privateInternalUrl + '" class="documentPrivateInternalUrlIcon"></i>';
				} else {
@@ -243,7 +243,7 @@ define([
				imgSrc = imgSrcPrefix + imagePath;

				var mustUseCredentials = useCredentials && typeof useCredentials === 'boolean';
				if (mustUseCredentials && Credentials.get('userRole') !== 'ROLE_GUEST') {
				if (mustUseCredentials && !Credentials.userIsGuest()) {
					imgSrc += '?access_token=' + Credentials.get('accessToken');
				}
			}
+2 −3
Original line number Diff line number Diff line
@@ -528,10 +528,9 @@ define([

		'SafeUrl': function(url, text, title) {

			var userRole = Credentials.get("userRole"),
				result;
			var result;

			if (userRole === "ROLE_ADMINISTRATOR" || userRole === "ROLE_OAG" || userRole === "ROLE_COLLABORATOR") {
			if (Credentials.userIsEditor()) {
				result = "<a href=" + url + " target='_blank' title='" + title + "'>" + text + "</a>";
			} else {
				result = text;
+14 −16
Original line number Diff line number Diff line
@@ -10,6 +10,18 @@ define([

	'use strict';

	var _dateFormat = function(value, mainFormat, altFormat) {

		if (!value) {
			return;
		}

		var format = ['en'].includes(dojoConfig.locale) ? altFormat : mainFormat,
			formatted = moment(value).format(format);

		return new handlebars.SafeString(formatted);
	};

	return {
		bold: function(text) {

@@ -48,26 +60,12 @@ define([

		'Date': function(value) {

			if (!value) {
				return;
			}

			var format = dojoConfig.locale === 'en' ? 'MM/DD/YYYY' : 'DD/MM/YYYY',
				formatted = moment(value).format(format);

			return new handlebars.SafeString(formatted);
			return _dateFormat(value, 'DD/MM/YYYY', 'MM/DD/YYYY');
		},

		DateTime: function(value) {

			if (!value) {
				return;
			}

			var format = dojoConfig.locale === 'en' ? 'MM/DD/YYYY HH:mm:ss' : 'DD/MM/YYYY HH:mm:ss',
				formatted = moment(value).format(format);

			return new handlebars.SafeString(formatted);
			return _dateFormat(value, 'DD/MM/YYYY HH:mm:ss', 'MM/DD/YYYY HH:mm:ss');
		},

		TextURL: function(url, text, title) {