save
Showing
12 changed files
with
284 additions
and
6 deletions
| ... | @@ -55,6 +55,10 @@ | ... | @@ -55,6 +55,10 @@ |
| 55 | <version>${org.aspectj-version}</version> | 55 | <version>${org.aspectj-version}</version> |
| 56 | </dependency> | 56 | </dependency> |
| 57 | 57 | ||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | |||
| 58 | <!-- Logging --> | 62 | <!-- Logging --> |
| 59 | <dependency> | 63 | <dependency> |
| 60 | <groupId>org.slf4j</groupId> | 64 | <groupId>org.slf4j</groupId> |
| ... | @@ -123,6 +127,20 @@ | ... | @@ -123,6 +127,20 @@ |
| 123 | <artifactId>jstl</artifactId> | 127 | <artifactId>jstl</artifactId> |
| 124 | <version>1.2</version> | 128 | <version>1.2</version> |
| 125 | </dependency> | 129 | </dependency> |
| 130 | |||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | |||
| 135 | |||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | |||
| 141 | |||
| 142 | |||
| 143 | |||
| 126 | 144 | ||
| 127 | <!-- Test --> | 145 | <!-- Test --> |
| 128 | <dependency> | 146 | <dependency> |
| ... | @@ -176,6 +194,9 @@ | ... | @@ -176,6 +194,9 @@ |
| 176 | </dependency> | 194 | </dependency> |
| 177 | 195 | ||
| 178 | 196 | ||
| 197 | |||
| 198 | |||
| 199 | |||
| 179 | 200 | ||
| 180 | </dependencies> | 201 | </dependencies> |
| 181 | 202 | ... | ... |
| ... | @@ -3,4 +3,9 @@ | ... | @@ -3,4 +3,9 @@ |
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 4 | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | 4 | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> |
| 5 | 5 | ||
| 6 | |||
| 7 | |||
| 8 | <!-- Файл с настройками безопасности --> | ||
| 9 | <import resource="security.xml" /> | ||
| 10 | |||
| 6 | </beans> | 11 | </beans> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | <beans:beans xmlns="http://www.springframework.org/schema/security" | ||
| 2 | xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 3 | xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
| 4 | http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | ||
| 5 | http://www.springframework.org/schema/security | ||
| 6 | http://www.springframework.org/schema/security/spring-security-3.0.xsd"> | ||
| 7 | |||
| 8 | |||
| 9 | <http access-denied-page="/error403.jsp"> | ||
| 10 | <intercept-url pattern="/" access="ROLE_USER,ROLE_ANONYMOUS" /> | ||
| 11 | <intercept-url pattern="/add*" access="ROLE_USER" /> | ||
| 12 | <intercept-url pattern="/delete/*" access="ROLE_ADMIN" /> | ||
| 13 | <form-login login-page="/login.jsp" default-target-url="/index" | ||
| 14 | authentication-failure-url="/login.jsp?error=true" /> | ||
| 15 | <logout logout-url="/logout" logout-success-url="/index" /> | ||
| 16 | |||
| 17 | <anonymous username="guest" granted-authority="ROLE_ANONYMOUS" /> | ||
| 18 | <remember-me /> | ||
| 19 | </http> | ||
| 20 | |||
| 21 | <authentication-manager> | ||
| 22 | <authentication-provider> | ||
| 23 | <user-service> | ||
| 24 | <user name="admin" password="pass" authorities="ROLE_ADMIN,ROLE_USER" /> | ||
| 25 | <user name="user1" password="1111" authorities="ROLE_USER" /> | ||
| 26 | <user name="user2" password="2222" disabled="true" authorities="ROLE_USER" /> | ||
| 27 | </user-service> | ||
| 28 | </authentication-provider> | ||
| 29 | </authentication-manager> | ||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | </beans:beans> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | 1 | ||
| 2 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | 2 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> |
| 3 | 3 | ||
| 4 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | ||
| 5 | |||
| 6 | |||
| 4 | <html> | 7 | <html> |
| 5 | <head> | 8 | <head> |
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | 9 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| ... | @@ -40,11 +43,34 @@ | ... | @@ -40,11 +43,34 @@ |
| 40 | } | 43 | } |
| 41 | 44 | ||
| 42 | 45 | ||
| 46 | .off { | ||
| 47 | background-image:url(resources/img/off.png) !important; | ||
| 48 | } | ||
| 49 | |||
| 50 | |||
| 43 | </style> | 51 | </style> |
| 44 | 52 | ||
| 45 | 53 | ||
| 46 | </head> | 54 | </head> |
| 47 | <body> | 55 | <body> |
| 56 | |||
| 57 | |||
| 58 | <h1>This is the body of the sample view</h1> | ||
| 59 | |||
| 60 | <security:authorize access="hasRole('ROLE_USER')"> | ||
| 61 | This text is only visible to a user | ||
| 62 | <br/> | ||
| 63 | </security:authorize> | ||
| 64 | |||
| 65 | <security:authorize access="hasRole('ROLE_ADMIN')"> | ||
| 66 | This text is only visible to an admin | ||
| 67 | <br/> | ||
| 68 | </security:authorize> | ||
| 69 | |||
| 70 | <a href="<c:url value="/perform_logout" />">Logout</a> | ||
| 71 | |||
| 72 | |||
| 73 | |||
| 48 | </body> | 74 | </body> |
| 49 | </html> | 75 | </html> |
| 50 | 76 | ... | ... |
| 1 | <%@ page language="java" contentType="text/html; charset=utf8" | ||
| 2 | pageEncoding="utf8"%> | ||
| 3 | <%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> | ||
| 4 | <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> | ||
| 5 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
| 6 | <html> | ||
| 7 | <head> | ||
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=utf8"> | ||
| 9 | <title><spring:message code="label.title" /></title> | ||
| 10 | </head> | ||
| 11 | <body> | ||
| 12 | |||
| 13 | <a href="<c:url value="/index" />"> | ||
| 14 | <spring:message code="label.contacts" /> | ||
| 15 | </a><br/> | ||
| 16 | |||
| 17 | <c:if test="${not empty param.error}"> | ||
| 18 | <font color="red"> <spring:message code="label.loginerror" /> | ||
| 19 | : ${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message} </font> | ||
| 20 | </c:if> | ||
| 21 | <form method="POST" action="<c:url value="/j_spring_security_check" />"> | ||
| 22 | <table> | ||
| 23 | <tr> | ||
| 24 | <td align="right"><spring:message code="label.login" /></td> | ||
| 25 | <td><input type="text" name="j_username" /></td> | ||
| 26 | </tr> | ||
| 27 | <tr> | ||
| 28 | <td align="right"><spring:message code="label.password" /></td> | ||
| 29 | <td><input type="password" name="j_password" /></td> | ||
| 30 | </tr> | ||
| 31 | <tr> | ||
| 32 | <td align="right"><spring:message code="label.remember" /></td> | ||
| 33 | <td><input type="checkbox" name="_spring_security_remember_me" /></td> | ||
| 34 | </tr> | ||
| 35 | <tr> | ||
| 36 | <td colspan="2" align="right"><input type="submit" value="Login" /> | ||
| 37 | <input type="reset" value="Reset" /></td> | ||
| 38 | </tr> | ||
| 39 | </table> | ||
| 40 | </form> | ||
| 41 | </body> | ||
| 42 | </html> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
688 Bytes
| ... | @@ -11,7 +11,8 @@ Ext.application({ | ... | @@ -11,7 +11,8 @@ Ext.application({ |
| 11 | 'Proxy', | 11 | 'Proxy', |
| 12 | 'DetailDns', | 12 | 'DetailDns', |
| 13 | 'DetailProxy', | 13 | 'DetailProxy', |
| 14 | 'RemoteServer' | 14 | 'RemoteServer', |
| 15 | 'DeviceControl' | ||
| 15 | 16 | ||
| 16 | 17 | ||
| 17 | 18 | ||
| ... | @@ -23,7 +24,8 @@ Ext.application({ | ... | @@ -23,7 +24,8 @@ Ext.application({ |
| 23 | 'DetailDns', | 24 | 'DetailDns', |
| 24 | 'Dns', | 25 | 'Dns', |
| 25 | 'Proxy', | 26 | 'Proxy', |
| 26 | 'RemoteServer' | 27 | 'RemoteServer', |
| 28 | 'DeviceControl' | ||
| 27 | 29 | ||
| 28 | 30 | ||
| 29 | ], | 31 | ], |
| ... | @@ -117,7 +119,14 @@ Ext.application({ | ... | @@ -117,7 +119,14 @@ Ext.application({ |
| 117 | 119 | ||
| 118 | { | 120 | { |
| 119 | title: 'Управление', | 121 | title: 'Управление', |
| 120 | items:[] | 122 | items:[ |
| 123 | |||
| 124 | { | ||
| 125 | xtype :'mvvm-DeviceControlView', | ||
| 126 | id:'formdevicecontrol' | ||
| 127 | } | ||
| 128 | |||
| 129 | ] | ||
| 121 | } | 130 | } |
| 122 | ] | 131 | ] |
| 123 | } | 132 | } | ... | ... |
| 1 | Ext.define('App.controller.DeviceControl', { | ||
| 2 | extend : 'Ext.app.Controller', | ||
| 3 | |||
| 4 | init : function() { | ||
| 5 | |||
| 6 | this.control({ | ||
| 7 | 'toolbar button[action=DcOff]' : { | ||
| 8 | click : this.DcOffClick | ||
| 9 | }, | ||
| 10 | |||
| 11 | 'toolbar button[action=DcReboot]' : { | ||
| 12 | click : this.DcRebootClick | ||
| 13 | } | ||
| 14 | }); | ||
| 15 | |||
| 16 | }, | ||
| 17 | |||
| 18 | DcOffClick:function() { | ||
| 19 | |||
| 20 | Ext.getBody().mask('Выключение устройства ...'); | ||
| 21 | |||
| 22 | /* | ||
| 23 | Ext.Ajax.request({ | ||
| 24 | method: "GET", | ||
| 25 | url: 'api/devinfo/', | ||
| 26 | headers: { | ||
| 27 | 'Accept': 'application/json', | ||
| 28 | 'Content-Type': 'application/json' | ||
| 29 | }, | ||
| 30 | |||
| 31 | success: function(response, opts) { | ||
| 32 | |||
| 33 | var result = Ext.JSON.decode(response.responseText); | ||
| 34 | |||
| 35 | Ext.getCmp('guid').setValue(result.guid); | ||
| 36 | Ext.getCmp('title').setValue(result.description); | ||
| 37 | |||
| 38 | }, failure: function(response, opts) { | ||
| 39 | } | ||
| 40 | }); | ||
| 41 | */ | ||
| 42 | |||
| 43 | }, | ||
| 44 | |||
| 45 | |||
| 46 | DcRebootClick : function(btn) { | ||
| 47 | |||
| 48 | |||
| 49 | Ext.getBody().mask('Перезагрузка устройства ...'); | ||
| 50 | |||
| 51 | /* | ||
| 52 | Ext.Ajax.request({ | ||
| 53 | method: "GET", | ||
| 54 | url: 'api/devinfo/', | ||
| 55 | headers: { | ||
| 56 | 'Accept': 'application/json', | ||
| 57 | 'Content-Type': 'application/json' | ||
| 58 | }, | ||
| 59 | |||
| 60 | success: function(response, opts) { | ||
| 61 | |||
| 62 | //var result = Ext.JSON.decode(response.responseText); | ||
| 63 | Ext.getBody('Перезагрузка устройства ...'); | ||
| 64 | |||
| 65 | // Ext.getCmp('guid').setValue(result.guid); | ||
| 66 | // Ext.getCmp('title').setValue(result.description); | ||
| 67 | |||
| 68 | }, failure: function(response, opts) { | ||
| 69 | } | ||
| 70 | }); | ||
| 71 | */ | ||
| 72 | |||
| 73 | |||
| 74 | } | ||
| 75 | }); | ||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 |
| ... | @@ -19,11 +19,8 @@ Ext.define('App.controller.MainConfig', { | ... | @@ -19,11 +19,8 @@ Ext.define('App.controller.MainConfig', { |
| 19 | }, | 19 | }, |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | |||
| 23 | onLoadButtonClick:function() { | 22 | onLoadButtonClick:function() { |
| 24 | 23 | ||
| 25 | |||
| 26 | |||
| 27 | Ext.Ajax.request({ | 24 | Ext.Ajax.request({ |
| 28 | method: "GET", | 25 | method: "GET", |
| 29 | url: 'api/devinfo/', | 26 | url: 'api/devinfo/', | ... | ... |
| 1 | Ext.define('App.view.DeviceControl', { | ||
| 2 | extend : 'Ext.form.Panel', | ||
| 3 | xtype : 'mvvm-DeviceControlView', | ||
| 4 | requires : [ | ||
| 5 | ], | ||
| 6 | |||
| 7 | frame : true, | ||
| 8 | padding : 10, | ||
| 9 | |||
| 10 | bind : { | ||
| 11 | }, | ||
| 12 | |||
| 13 | |||
| 14 | bbar: {items: [{ | ||
| 15 | xtype: 'button', | ||
| 16 | iconCls:'off', | ||
| 17 | itemId: 'btnOffDc', | ||
| 18 | text: 'Выключить', | ||
| 19 | action: 'DcOff', | ||
| 20 | disabled:false | ||
| 21 | }, | ||
| 22 | { | ||
| 23 | xtype: 'button', | ||
| 24 | iconCls:'restart', | ||
| 25 | itemId: 'btnRebootDc', | ||
| 26 | text: 'Перезагрузить', | ||
| 27 | action: 'DcReboot', | ||
| 28 | disabled:false | ||
| 29 | }] | ||
| 30 | }, | ||
| 31 | |||
| 32 | items : [] | ||
| 33 | }); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment