profile.jsp 7.01 KB
Newer Older
Matija Obreza's avatar
Matija Obreza committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>

<%@include file="/WEB-INF/jsp/init.jsp"%>

<html>
<head>
<title><spring:message code="userprofile.page.title" /></title>
</head>
<body>
	<h1>
		<spring:message code="userprofile.page.title" />
	</h1>

	<security:authorize access="hasRole('ADMINISTRATOR') || (isAuthenticated() && principal.user.id == #user.id)">
15
		<a href="<c:url value="/profile/${user.uuid}/edit" />" class="close"> <spring:message code="edit" /></a>
Matija Obreza's avatar
Matija Obreza committed
16
17
18
19
20
	</security:authorize>

	<div class="form-horizontal">
		<div class="form-group">
			<label for="password" class="col-lg-2 control-label"><spring:message code="user.full-name" /></label>
Matija Obreza's avatar
Matija Obreza committed
21
			<div class="col-lg-5">${user.name}</div>
Matija Obreza's avatar
Matija Obreza committed
22
23
24
25
26
		</div>

		<security:authorize access="hasRole('ADMINISTRATOR') || (isAuthenticated() && principal.user.id == #user.id)">
			<div class="form-group">
				<label for="password" class="col-lg-2 control-label"><spring:message code="user.email" /></label>
Matija Obreza's avatar
Matija Obreza committed
27
				<div class="col-lg-5">${user.email}</div>
Matija Obreza's avatar
Matija Obreza committed
28
			</div>
29

30
31
			<div class="form-group">
				<label class="col-lg-2 control-label"><spring:message code="user.account-status" /></label>
Matija Obreza's avatar
Matija Obreza committed
32
				<div class="col-lg-5">
33
					<c:if test="${user.systemAccount}">SYSTEM</c:if>
Matija Obreza's avatar
Matija Obreza committed
34
35
36
37
					<c:if test="${not user.enabled}"><spring:message code="user.account-disabled" /></c:if>
					<c:if test="${user.accountLocked}"><spring:message code="user.account-locked-until" />
						<fmt:formatDate value="${user.lockedUntil}" type="time" />
					</c:if>
38
				</div>
Matija Obreza's avatar
Matija Obreza committed
39
			</div>
igoshin's avatar
igoshin committed
40

Matija Obreza's avatar
Matija Obreza committed
41
42
			<div class="form-group">
				<label class="col-lg-2 control-label"><spring:message code="user.roles" /></label>
43
				<div class="col-lg-10">
Matija Obreza's avatar
Matija Obreza committed
44
					<c:forEach items="${user.roles}" var="role">
45
						<div>${role}</div>
Matija Obreza's avatar
Matija Obreza committed
46
47
48
					</c:forEach>
				</div>
			</div>
49

Matija Obreza's avatar
Matija Obreza committed
50
		</security:authorize>
51
52


Matija Obreza's avatar
Matija Obreza committed
53
	</div>
54

Matija Obreza's avatar
Matija Obreza committed
55
	<div class="form-group">
56

57
58
59
	<security:authorize access="hasRole('ADMINISTRATOR')">
		<button class="btn" id="acccount-lock">Lock</button>
		<button class="btn" id="acccount-unlock">Unlock</button>
60

61
62
63
64
		<button class="btn" id="acccount-disable">Disable</button>
		<button class="btn" id="acccount-enable">Enable</button>
	</div>
	</security:authorize>
65
66

    <div class="form-group">
67
68
69
                <security:authorize access="hasRole('ADMINISTRATOR') && (isAuthenticated() && principal.user.id == #user.id)">
                    <a href="<c:url value="/management/allTokens" />" class="btn btn-default"> <spring:message code="oauth-client.list" /></a>
                </security:authorize>
70
                <security:authorize access="hasRole('ADMINISTRATOR') || (isAuthenticated() && principal.user.id == #user.id)">
71
                    <a href="<c:url value="/management/user/${user.uuid}/tokens" />" class="btn btn-default"><spring:message code="oauth-client.issued.tokens" /></a>
72
                </security:authorize>
Matija Obreza's avatar
Matija Obreza committed
73
74
                <security:authorize access="hasRole('ADMINISTRATOR') || principal.user.id == #user.id">
                	<c:if test="${not user.hasRole('VALIDATEDUSER')}">
75
                    <a href="<c:url value="/profile/${user.uuid}/send"/>"  class="btn btn-default"/>Send validation email</a>
Matija Obreza's avatar
Matija Obreza committed
76
77
                    </c:if>
                </security:authorize>
78
                <security:authorize access="hasAnyRole('VETTEDUSER','ADMINISTRATOR')">
igoshin's avatar
igoshin committed
79
80
                     <a href="<c:url value="/management/addClient" />" class="btn btn-default"><spring:message code="client.details.add" /></a>
                </security:authorize>
Matija Obreza's avatar
Matija Obreza committed
81
82
83
84
                <security:authorize access="hasRole('ADMINISTRATOR')">
                	<c:if test="${not user.hasRole('VETTEDUSER')}">
					<a href="<c:url value="/profile/${user.uuid}/vetted-user"/> "class="btn btn-default"/>Vetted user</a>
					</c:if>
85
                </security:authorize>
igoshin's avatar
igoshin committed
86
87
88
                <security:authorize access="isAuthenticated()">
                    <a href="#" data-toggle="modal"  data-target="#myModal" class="btn btn-default get_widget" id="get_widget">Get Widget</a>
                </security:authorize>
89
90
    </div>

Matija Obreza's avatar
Matija Obreza committed
91
	<h3><spring:message code="team.user-teams" /></h3>
Matija Obreza's avatar
Matija Obreza committed
92

Matija Obreza's avatar
Matija Obreza committed
93
94
95
	<ul class="funny-list">
	<c:forEach items="${teams}" var="team" varStatus="status">
		<li class="${status.count % 2 == 0 ? 'even' : 'odd'}"><a href="<c:url value="/team/${team.uuid}" />"><c:out value="${team.name}" /></a>
96

Matija Obreza's avatar
Matija Obreza committed
97
98
99
100
101
102
			<security:authorize access="isAuthenticated() && principal.user.id == #user.id">
			<a x-team-id="${team.id}" class="pull-right"><spring:message code="team.leave-team" /></a>
			</security:authorize>
		</li>
	</c:forEach>
	</ul>
103

igoshin's avatar
igoshin committed
104
105
106
107
108
109
110
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content"></div>
        </div>
    </div>
    <!--End modal-->
Matija Obreza's avatar
Matija Obreza committed
111
112
113
114
115
116
117
	<security:authorize access="isAuthenticated() && principal.user.id == #user.id">
	<h4><spring:message code="team.create-new-team" /></h4>
	<form id="new-team-form" class="form-horizontal">
		<div class="form-group">
			<label for="team-name" class="col-lg-2 control-label"><spring:message code="team.team-name" /></label>
			<div class="col-lg-3"><input type="text" name="name" id="team-name" class="span3 form-control" /></div>
			<div class="col-lg-1">
118
				<input type="submit" value="<spring:message code="create" />" class="btn btn-primary" />
Matija Obreza's avatar
Matija Obreza committed
119
120
121
			</div>
		</div>
	</form>
122
	</security:authorize>
123

124
<content tag="javascript">
125
	<security:authorize access="isAuthenticated()">
Matija Obreza's avatar
Matija Obreza committed
126
127
128
129
	<script src="<c:url value="/html/js/main.js" />"></script>
	<script src="<c:url value="/html/js/jsonclient.js" />"></script>
	<script type="text/javascript">
	jQuery(document).ready(function() {
130

igoshin's avatar
igoshin committed
131
132


133
	<security:authorize access="principal.user.id == #user.id">
Matija Obreza's avatar
Matija Obreza committed
134
135
136
137
138
139
		$("#new-team-form input[type=submit]").on("click", function(e) {
			e.preventDefault();
			x01("<c:url value="/json/v0/me/teams" />", { success: function(e) {
				window.location.reload();
			}}, $(this.form).serializeObject());
		});
140

Matija Obreza's avatar
Matija Obreza committed
141
142
		$("a[x-team-id]").on("click", function(e) {
			e.preventDefault();
143
			x01("<c:url value="/json/v0/me/teams/" />" + $(this).attr('x-team-id') + "/leave",
Matija Obreza's avatar
Matija Obreza committed
144
145
146
147
					{ success: function(e) {
						window.location.reload();
					}});
		});
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
	</security:authorize>

	<security:authorize access="hasRole('ADMINISTRATOR')">
		$("button#acccount-enable").on("click", function(e) {
			e.preventDefault();
			x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
				window.location.reload();
			}}, true);
		});
		$("button#acccount-disable").on("click", function(e) {
			e.preventDefault();
			x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
				window.location.reload();
			}}, false);
		});
		$("button#acccount-lock").on("click", function(e) {
			e.preventDefault();
			x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
				window.location.reload();
			}}, true);
		});
		$("button#acccount-unlock").on("click", function(e) {
			e.preventDefault();
			x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
				window.location.reload();
			}}, false);
		});
	</security:authorize>
Matija Obreza's avatar
Matija Obreza committed
176
177
	});
	</script>
178
	</security:authorize>
179
</content>
Matija Obreza's avatar
Matija Obreza committed
180
181
</body>
</html>