Verwaltung von LDAP Accounts und Gruppen
Peter Hormanns
2021-12-07 694d20e4b72fbb2283a8f4230ee781e2839d9273
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:setBundle basename="de.jalin.ldapadmin.users"/>
<!DOCTYPE html>
<html lang="{language}">
<jsp:include page="template/header.jsp"/>
<body>
    <jsp:include page="template/navbar.jsp"/>
    <c:url var="formaction" value="/user/${user.dn}?op=${operation}" />
    <c:if test="${ operation eq 'password' }">
        <c:url var="formaction" value="/profile/${user.dn}?op=${operation}" />
    </c:if>
    <div class="container">
        <h1 class="col-sm-offset-3">${user.firstname} ${user.lastname}<c:if test="${ operation eq 'create' }"><fmt:message key="users.title.new"/></c:if></h1>
        <c:if test="${ not empty errormessage }">
            <div class="alert alert-error col-sm-offset-3">
              <a class="close" data-dismiss="alert">×</a>
              <strong><fmt:message key="users.error.title"/></strong> ${errormessage}
            </div>
        </c:if>
        <c:if test="${ not empty successmessage }">
            <div class="alert alert-success col-sm-offset-3">
              <a class="close" data-dismiss="alert">×</a>
              ${successmessage}
            </div>
        </c:if>
        <c:if test="${ operation eq 'profile' }">
            <div class="control-group">
                <div class="btn-group col-sm-12">
                    <c:url var="edituserurl" value="/profile/${user.dn}?op=password" />
                    <a href="${edituserurl}" class="btn btn-default pull-right additional-space-bottom"><fmt:message key="users.operations.changepassword"/></a>
                </div>
            </div>
        </c:if>
        <c:if test="${ operation eq 'view' }">
            <div class="control-group">
                <div class="btn-group col-sm-12">
                    <c:url var="edituserurl" value="/user/${user.dn}?op=edit" />
                    <a href="${edituserurl}" class="btn btn-default pull-right additional-space-bottom"><fmt:message key="users.operations.edit"/></a>
                </div>
            </div>
        </c:if>
        <c:if test="${ operation eq 'delete' }">
            <div class="control-group">
                <div class="col-sm-12">
                    <p class="col-sm-offset-3"><fmt:message key="users.confirm.delete"/></p>
                </div>
            </div>
        </c:if>
        <c:if test="${ (operation ne 'view') and (operation ne 'profile') }">
            <div class="additional-space-top">&nbsp;</div>
        </c:if>
        <div class="control-group">
            <form class="form-horizontal" method="post" action="${formaction}">
                <fieldset ${formdisabled} class="col-sm-12">
                    <div class="form-group">
                        <label for="login" class="col-sm-3 control-label"><fmt:message key="users.label.login"/></label> 
                        <div class="col-sm-9">
                            <input ${iddisabled}
                                type="text" class="form-control" id="login" name="login"
                                value="${user.login}" placeholder="Enter login">
                        </div>
                    </div>
                    <c:if test="${ operation ne 'password' }">
                        <div class="form-group">
                            <label for="firstname" class="col-sm-3 control-label"><fmt:message key="users.label.firstname"/></label> 
                            <div class="col-sm-9">
                                <input
                                    type="text" class="form-control" id="firstname" name="firstname"
                                    value="${user.firstname}" placeholder="Enter firstname">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lastname" class="col-sm-3 control-label"><fmt:message key="users.label.lastname"/></label> 
                            <div class="col-sm-9">
                                <input
                                    type="text" class="form-control" id="lastname" name="lastname"
                                    value="${user.lastname}" placeholder="Enter lastname">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="email" class="col-sm-3 control-label"><fmt:message key="users.label.email"/></label> 
                            <div class="col-sm-9">
                                <input
                                    type="email" class="form-control" id="email" name="email"
                                    value="${user.email}" placeholder="Enter email">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="phone" class="col-sm-3 control-label"><fmt:message key="users.label.phone"/></label> 
                            <div class="col-sm-9">
                                <input
                                    type="tel" class="form-control" id="phone" name="phone"
                                    value="${user.phone}" placeholder="Enter phone">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="mobile" class="col-sm-3 control-label"><fmt:message key="users.label.mobile"/></label> 
                            <div class="col-sm-9">
                                <input
                                    type="tel" class="form-control" id="mobile" name="mobile"
                                    value="${user.mobile}" placeholder="Enter mobile">
                            </div>
                        </div>
                    </c:if>
                    <c:if test="${ (operation eq 'create') or (operation eq 'edit') or (operation eq 'password') }">
                        <div class="form-group">
                            <label for="password" class="col-sm-3 control-label"><fmt:message key="users.label.password"/></label> 
                            <div class="col-sm-9">
                                <input
                                    type="password" class="form-control" id="password" name="password"
                                    value="" placeholder="Enter password">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="password2" class="col-sm-3 control-label"><fmt:message key="users.label.password.repeat"/></label> 
                            <div class="col-sm-9">
                                <input
                                    type="password" class="form-control" id="password2" name="password2"
                                    value="" placeholder="Repeat password">
                            </div>
                        </div>
                    </c:if>
                    <c:if test="${ operation ne 'password' }">
                        <div class="form-group">
                            <label for="membership" class="col-sm-3 control-label"><fmt:message key="users.label.memberof"/></label> 
                            <div class="col-sm-9" id ="membership">
                                <c:forEach items="${groups}" var="groupentry" >
                                    <div class="checkbox">
                                        <jsp:useBean id="checker" class="de.jalin.ldapadmin.beans.MembershipCheck" />
                                        <jsp:setProperty property="user" name="checker" value="${user}" />
                                        <jsp:setProperty property="group" name="checker" value="${groupentry.value}" />
                                        <label><input type="checkbox" id="${groupentry.value.name}" name="check_group_${groupentry.value.name}" ${checker.checked}>${groupentry.value.name}</label>
                                    </div>
                                </c:forEach>
                            </div>
                        </div>
                    </c:if>
                    <c:if test="${ formdisabled ne 'disabled' }">
                        <button type="submit" class="col-sm-offset-3 btn btn-primary additional-space-top"><fmt:message key="users.operations.update"/></button>
                    </c:if>
                </fieldset>
                <c:if test="${ operation eq 'delete' }">
                    <button type="submit" class="col-sm-offset-3 btn btn-primary additional-space-top"><fmt:message key="users.operations.delete"/></button>
                </c:if>
            </form>
        </div>
    </div>
    <jsp:include  page="template/footer.jsp"/>
</body>
</html>