1 | <%@ page import="org.codehaus.groovy.grails.plugins.PluginManagerHolder" %> |
---|
2 | |
---|
3 | <sec:ifNotSwitched> |
---|
4 | <sec:ifAllGranted roles='ROLE_SWITCH_USER'> |
---|
5 | <g:if test='${user.username}'> |
---|
6 | <g:set var='canRunAs' value='${true}'/> |
---|
7 | </g:if> |
---|
8 | </sec:ifAllGranted> |
---|
9 | </sec:ifNotSwitched> |
---|
10 | |
---|
11 | <head> |
---|
12 | <meta name='layout' content='springSecurityUI'/> |
---|
13 | <g:set var="entityName" value="${message(code: 'user.label', default: 'User')}"/> |
---|
14 | <title><g:message code="default.edit.label" args="[entityName]"/></title> |
---|
15 | </head> |
---|
16 | |
---|
17 | <body> |
---|
18 | |
---|
19 | <h3><g:message code="default.edit.label" args="[entityName]"/></h3> |
---|
20 | |
---|
21 | <g:form action="update" name='userEditForm' class="button-style"> |
---|
22 | <g:hiddenField name="id" value="${user?.id}"/> |
---|
23 | <g:hiddenField name="version" value="${user?.version}"/> |
---|
24 | |
---|
25 | <% |
---|
26 | def tabData = [] |
---|
27 | tabData << [name: 'userinfo', icon: 'icon_user', messageCode: 'spring.security.ui.user.info'] |
---|
28 | tabData << [name: 'roles', icon: 'icon_role', messageCode: 'spring.security.ui.user.roles'] |
---|
29 | boolean isOpenId = PluginManagerHolder.pluginManager.hasGrailsPlugin('springSecurityOpenid') |
---|
30 | if (isOpenId) { |
---|
31 | tabData << [name: 'openIds', icon: 'icon_role', messageCode: 'spring.security.ui.user.openIds'] |
---|
32 | } |
---|
33 | %> |
---|
34 | |
---|
35 | <s2ui:tabs elementId='tabs' height='375' data="${tabData}"> |
---|
36 | |
---|
37 | <s2ui:tab name='userinfo' height='275'> |
---|
38 | <table> |
---|
39 | <tbody> |
---|
40 | |
---|
41 | <s2ui:textFieldRow name='username' labelCode='user.username.label' bean="${user}" |
---|
42 | labelCodeDefault='Username' value="${user?.username}"/> |
---|
43 | |
---|
44 | <s2ui:passwordFieldRow name='password' labelCode='user.password.label' bean="${user}" |
---|
45 | labelCodeDefault='Password' value="${user?.password}"/> |
---|
46 | |
---|
47 | <s2ui:checkboxRow name='userConfirmed' labelCode='user.confirmed.label' bean="${user}" |
---|
48 | labelCodeDefault='Confirmed (by user)' value="${user?.userConfirmed}"/> |
---|
49 | |
---|
50 | <s2ui:checkboxRow name='adminConfirmed' labelCode='user.approved.label' bean="${user}" |
---|
51 | labelCodeDefault='Approved (by administrator)' value="${user?.adminConfirmed}"/> |
---|
52 | |
---|
53 | <s2ui:checkboxRow name='accountExpired' labelCode='user.accountExpired.label' bean="${user}" |
---|
54 | labelCodeDefault='Account Expired' value="${user?.accountExpired}"/> |
---|
55 | |
---|
56 | <s2ui:checkboxRow name='accountLocked' labelCode='user.accountLocked.label' bean="${user}" |
---|
57 | labelCodeDefault='Account Locked' value="${user?.accountLocked}"/> |
---|
58 | |
---|
59 | <s2ui:checkboxRow name='passwordExpired' labelCode='user.passwordExpired.label' bean="${user}" |
---|
60 | labelCodeDefault='Password Expired' value="${user?.passwordExpired}"/> |
---|
61 | </tbody> |
---|
62 | </table> |
---|
63 | </s2ui:tab> |
---|
64 | |
---|
65 | <s2ui:tab name='roles' height='275'> |
---|
66 | <g:each var="entry" in="${roleMap}"> |
---|
67 | <div> |
---|
68 | <g:checkBox name="${entry.key.authority}" value="${entry.value}"/> |
---|
69 | <g:link controller='role' action='edit' id='${entry.key.id}'>${entry.key.authority.encodeAsHTML()}</g:link> |
---|
70 | </div> |
---|
71 | </g:each> |
---|
72 | </s2ui:tab> |
---|
73 | |
---|
74 | <g:if test='${isOpenId}'> |
---|
75 | <s2ui:tab name='openIds' height='275'> |
---|
76 | <g:if test='${user?.openIds}'> |
---|
77 | <ul> |
---|
78 | <g:each var="openId" in="${user.openIds}"> |
---|
79 | <li>${openId.url}</li> |
---|
80 | </g:each> |
---|
81 | </ul> |
---|
82 | </g:if> |
---|
83 | <g:else> |
---|
84 | No OpenIDs registered |
---|
85 | </g:else> |
---|
86 | </s2ui:tab> |
---|
87 | </g:if> |
---|
88 | |
---|
89 | </s2ui:tabs> |
---|
90 | |
---|
91 | <div style='float:left; margin-top: 10px;'> |
---|
92 | <s2ui:submitButton elementId='update' form='userEditForm' messageCode='default.button.update.label'/> |
---|
93 | |
---|
94 | <g:if test='${user}'> |
---|
95 | <s2ui:deleteButton /> |
---|
96 | </g:if> |
---|
97 | |
---|
98 | <g:if test='${canRunAs}'> |
---|
99 | <a id="runAsButton">${message(code:'spring.security.ui.runas.submit')}</a> |
---|
100 | </g:if> |
---|
101 | |
---|
102 | </div> |
---|
103 | |
---|
104 | </g:form> |
---|
105 | |
---|
106 | <g:if test='${user}'> |
---|
107 | <s2ui:deleteButtonForm instanceId='${user.id}'/> |
---|
108 | </g:if> |
---|
109 | |
---|
110 | <g:if test='${canRunAs}'> |
---|
111 | <form name='runAsForm' action='${request.contextPath}/j_spring_security_switch_user' method='POST'> |
---|
112 | <g:hiddenField name='j_username' value="${user.username}"/> |
---|
113 | <input type='submit' class='s2ui_hidden_button' /> |
---|
114 | </form> |
---|
115 | </g:if> |
---|
116 | |
---|
117 | <script> |
---|
118 | $(document).ready(function() { |
---|
119 | $('#username').focus(); |
---|
120 | |
---|
121 | <s2ui:initCheckboxes/> |
---|
122 | |
---|
123 | $("#runAsButton").button(); |
---|
124 | $('#runAsButton').bind('click', function() { |
---|
125 | document.forms.runAsForm.submit(); |
---|
126 | }); |
---|
127 | }); |
---|
128 | </script> |
---|
129 | |
---|
130 | </body> |
---|