Commit 9cdaf010858bb7be02c0138ed46dc6a4b06b276c
1 parent
02bb6ffc
Exists in
master
and in
7 other branches
Inclusão de login para permitir salvar querys
Showing
5 changed files
with
267 additions
and
5 deletions
Show diff stats
@@ -0,0 +1,36 @@ | @@ -0,0 +1,36 @@ | ||
1 | +<?php | ||
2 | +include_once(dirname(__FILE__)."/login.php"); | ||
3 | +$funcoesEdicao = array( | ||
4 | + "OBTEMDADOSTABELADB" | ||
5 | +); | ||
6 | +if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
7 | + if(verificaOperacaoSessao("admin/metaestat/geral") == false){ | ||
8 | + exit; | ||
9 | + } | ||
10 | +} | ||
11 | +?> | ||
12 | +<html> | ||
13 | +<head> | ||
14 | +<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
15 | +<style type="text/css"> | ||
16 | +body { | ||
17 | + margin: 0; | ||
18 | + padding: 0; | ||
19 | +} | ||
20 | +</style> | ||
21 | +<script type="text/javascript" src="../js/core.js"></script> | ||
22 | +<script type="text/javascript" src="../js/estat_editor.js"></script> | ||
23 | +<link rel="stylesheet" type="text/css" href="admin.css"> | ||
24 | +</head> | ||
25 | +<body> | ||
26 | + <script> | ||
27 | + //necessario para a ferramenta login e outras | ||
28 | + i3GEO.configura = { | ||
29 | + locaplic : "../.." | ||
30 | + }; | ||
31 | + temp = function() { | ||
32 | + <?php echo "i3GEOadmin.editor.tabela.mostrar($nreg, '$nome_tabela', '$nomeEsquema', '$codigo_estat_conexao', window);\n"; ?> | ||
33 | + }; | ||
34 | + i3GEO.login.verificaOperacao("admin/metaestat/geral",i3GEO.configura.locaplic, temp, "sessao",i3GEO.login.dialogo.abreLogin); | ||
35 | + </script> | ||
36 | +</body> |
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/index.html
@@ -302,9 +302,12 @@ | @@ -302,9 +302,12 @@ | ||
302 | <li><a href="#open_query" | 302 | <li><a href="#open_query" |
303 | class="i18n open button sprite" | 303 | class="i18n open button sprite" |
304 | title="Open query"></a></li> | 304 | title="Open query"></a></li> |
305 | + <!-- Bloqueia o botao se o login for anonimo --> | ||
306 | + <% if (Saiku.session.attributes.username != "anonimo") {%> | ||
305 | <li><a href="#save_query" | 307 | <li><a href="#save_query" |
306 | class="i18n save button disabled_toolbar sprite" | 308 | class="i18n save button disabled_toolbar sprite" |
307 | title="Save query"></a></li> | 309 | title="Save query"></a></li> |
310 | + <%};%> | ||
308 | <li class="seperator"><a href="#run_query" | 311 | <li class="seperator"><a href="#run_query" |
309 | class="i18n run button disabled_toolbar sprite" | 312 | class="i18n run button disabled_toolbar sprite" |
310 | title="Run query"></a></li> | 313 | title="Run query"></a></li> |
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/Settings.js
0 → 100755
@@ -0,0 +1,158 @@ | @@ -0,0 +1,158 @@ | ||
1 | +/* | ||
2 | + * Copyright 2012 OSBI Ltd | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +/** | ||
18 | + * Change settings here | ||
19 | + */ | ||
20 | + | ||
21 | +var Settings = { | ||
22 | + VERSION: "Saiku 2.5", | ||
23 | + BIPLUGIN: false, | ||
24 | + BASE_URL: "", | ||
25 | + TOMCAT_WEBAPP: "/saiku", | ||
26 | + REST_MOUNT_POINT: "/rest/saiku/", | ||
27 | + DIMENSION_PREFETCH: false, | ||
28 | + ERROR_LOGGING: false, | ||
29 | + // number of erroneous ajax calls in a row before UI cant recover | ||
30 | + ERROR_TOLERANCE: 3, | ||
31 | + QUERY_PROPERTIES: { | ||
32 | + 'saiku.olap.query.automatic_execution': 'true', | ||
33 | + 'saiku.olap.query.nonempty': 'true', | ||
34 | + 'saiku.olap.query.nonempty.rows': 'true', | ||
35 | + 'saiku.olap.query.nonempty.columns': 'true', | ||
36 | + 'saiku.ui.render.mode' : 'table' | ||
37 | + }, | ||
38 | + /* Valid values for CELLSET_FORMATTER: | ||
39 | + * 1) flattened | ||
40 | + * 2) flat | ||
41 | + */ | ||
42 | + CELLSET_FORMATTER: "flattened", | ||
43 | + // limits the number of rows in the result | ||
44 | + // 0 - no limit | ||
45 | + RESULT_LIMIT: 0, | ||
46 | + MEMBERS_FROM_RESULT: true, | ||
47 | + PLUGINS: [ | ||
48 | + "Chart" | ||
49 | + ], | ||
50 | + TELEMETRY_SERVER: 'http://telemetry.analytical-labs.com:7000', | ||
51 | + LOCALSTORAGE_EXPIRATION: 10 * 60 * 60 * 1000 /* 10 hours, in ms */ | ||
52 | +}; | ||
53 | +/** | ||
54 | + * Extend settings with query parameters | ||
55 | + */ | ||
56 | +Settings.GET = function () { | ||
57 | + var qs = document.location.search; | ||
58 | + qs = qs.split("+").join(" "); | ||
59 | + var params = {}, | ||
60 | + tokens, | ||
61 | + re = /[?&]?([^=]+)=([^&]*)/g; | ||
62 | + | ||
63 | + while (tokens = re.exec(qs)) { | ||
64 | + var value = decodeURIComponent(tokens[2]); | ||
65 | + if (! isNaN(value)) value = parseInt(value); | ||
66 | + if (value === "true") value = true; | ||
67 | + if (value === "false") value = false; | ||
68 | + params[decodeURIComponent(tokens[1]).toUpperCase()] | ||
69 | + = value; | ||
70 | + } | ||
71 | + | ||
72 | + return params; | ||
73 | +}(); | ||
74 | +_.extend(Settings, Settings.GET); | ||
75 | + | ||
76 | +Settings.REST_URL = Settings.BASE_URL | ||
77 | + + Settings.TOMCAT_WEBAPP | ||
78 | + + Settings.REST_MOUNT_POINT; | ||
79 | + | ||
80 | +// lets assume we dont need a min width/height for table mode | ||
81 | +if (Settings.MODE == "table") { | ||
82 | + Settings.DIMENSION_PREFETCH = false; | ||
83 | + $('body, html').css('min-height',0); | ||
84 | + $('body, html').css('min-width',0); | ||
85 | + | ||
86 | +} | ||
87 | + | ||
88 | + | ||
89 | +/** | ||
90 | + * < IE9 doesn't support Array.indexOf | ||
91 | + */ | ||
92 | +if (!Array.prototype.indexOf) | ||
93 | +{ | ||
94 | + Array.prototype.indexOf = function(elt /*, from*/) | ||
95 | + { | ||
96 | + var len = this.length >>> 0; | ||
97 | + | ||
98 | + var from = Number(arguments[1]) || 0; | ||
99 | + from = (from < 0) | ||
100 | + ? Math.ceil(from) | ||
101 | + : Math.floor(from); | ||
102 | + if (from < 0) | ||
103 | + from += len; | ||
104 | + | ||
105 | + for (; from < len; from++) | ||
106 | + { | ||
107 | + if (from in this && | ||
108 | + this[from] === elt) | ||
109 | + return from; | ||
110 | + } | ||
111 | + return -1; | ||
112 | + }; | ||
113 | +} | ||
114 | + | ||
115 | +var tagsToReplace = { | ||
116 | + '&': '&', | ||
117 | + '<': '<', | ||
118 | + '>': '>' | ||
119 | +}; | ||
120 | + | ||
121 | +function replaceTag(tag) { | ||
122 | + return tagsToReplace[tag] || tag; | ||
123 | +} | ||
124 | + | ||
125 | +function safe_tags_replace(str) { | ||
126 | + return str.replace(/[&<>]/g, replaceTag); | ||
127 | +} | ||
128 | + | ||
129 | +if ($.blockUI) { | ||
130 | + $.blockUI.defaults.css = {}; | ||
131 | + $.blockUI.defaults.overlayCSS = {}; | ||
132 | + $.blockUI.defaults.blockMsgClass = 'processing'; | ||
133 | + $.blockUI.defaults.fadeOut = 0; | ||
134 | + $.blockUI.defaults.fadeIn = 0; | ||
135 | + $.blockUI.defaults.ignoreIfBlocked = false; | ||
136 | + | ||
137 | +} | ||
138 | +//original alterado por Edmar Moretti | ||
139 | +/* | ||
140 | +if (window.location.hostname && (window.location.hostname == "dev.analytical-labs.com" || window.location.hostname == "demo.analytical-labs.com" )) { | ||
141 | + Settings.USERNAME = "admin"; | ||
142 | + Settings.PASSWORD = "admin"; | ||
143 | +} | ||
144 | +*/ | ||
145 | +//comente essas linhas abaixo para forcar o login | ||
146 | +//Settings.USERNAME = "i3geo"; | ||
147 | +//Settings.PASSWORD = "i3geo"; | ||
148 | + | ||
149 | +var isIE = (function(){ | ||
150 | + var undef, v = 3, div = document.createElement('div'); | ||
151 | + | ||
152 | + while ( | ||
153 | + div.innerHTML = '<!--[if gt IE '+(++v)+']><i></i><![endif]-->', | ||
154 | + div.getElementsByTagName('i')[0] | ||
155 | + ); | ||
156 | + | ||
157 | + return v> 4 ? v : false; | ||
158 | +}()); |
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/views/LoginForm.js
0 → 100755
@@ -0,0 +1,65 @@ | @@ -0,0 +1,65 @@ | ||
1 | +/* | ||
2 | + * Copyright 2012 OSBI Ltd | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +/** | ||
18 | + * The login prompt on startup | ||
19 | + */ | ||
20 | +var LoginForm = Modal.extend({ | ||
21 | + type: "login", | ||
22 | + message: "<form id='login_form'>" + | ||
23 | + "<label for='username'>Username</label><br />" + | ||
24 | + "<input type='text' id='username' name='username' value='anonimo' /><br />" + | ||
25 | + "<label for='password'>Password</label><br />" + | ||
26 | + "<input type='password' id='password' name='password' value='anonimo' />" + | ||
27 | + "</form>", | ||
28 | + | ||
29 | + buttons: [ | ||
30 | + { text: "Login", method: "login" } | ||
31 | + ], | ||
32 | + | ||
33 | + events: { | ||
34 | + 'click a': 'call', | ||
35 | + 'keyup #login_form input': 'check' | ||
36 | + }, | ||
37 | + | ||
38 | + initialize: function(args) { | ||
39 | + _.extend(this, args); | ||
40 | + _.bindAll(this, "adjust"); | ||
41 | + this.options.title = Settings.VERSION; | ||
42 | + this.bind('open', this.adjust); | ||
43 | + }, | ||
44 | + | ||
45 | + adjust: function() { | ||
46 | + $(this.el).parent().find('.ui-dialog-titlebar-close').hide(); | ||
47 | + $(this.el).find("#username").select().focus(); | ||
48 | + }, | ||
49 | + | ||
50 | + check: function(event) { | ||
51 | + if(event.which === 13) { | ||
52 | + this.login(); | ||
53 | + } | ||
54 | + }, | ||
55 | + | ||
56 | + login: function() { | ||
57 | + | ||
58 | + var l_username = $(this.el).find("#username").val(); | ||
59 | + var l_password = $(this.el).find("#password").val(); | ||
60 | + $(this.el).dialog('close'); | ||
61 | + this.session.login(l_username, l_password); | ||
62 | + | ||
63 | + return true; | ||
64 | + } | ||
65 | +}); |
ferramentas/saiku/saiku-server/tomcat/webapps/saiku/WEB-INF/users.properties
1 | #Username,password,role | 1 | #Username,password,role |
2 | -bob=dylan,ROLE_USER | ||
3 | -krishna=krish2341,ROLE_USER | ||
4 | -smith=pravah@001,ROLE_USER | ||
5 | -adminx=admin,ROLE_USER,ROLE_ADMIN | ||
6 | -admin=admin,ROLE_USER | 2 | +#qualquer usuario que nao seja i3geo e nao seja admin podera usar o botao de salvar query |
3 | +#remova o usuario i3geo para forcar o login | ||
4 | +#edite o arquivo ROOT/js/Settings.js e comente as linhas que usam o usuario i3geo como default | ||
5 | +anonimo=anonimo,ROLE_USER | ||
6 | + |