Commit 7e3d5a47 authored by michael.simon's avatar michael.simon
Browse files

More changes in webapp to reflect attribute-sources

parent 55a6e548
......@@ -56,8 +56,8 @@ public interface RegistryDao extends BaseDao<RegistryEntity, Long> {
List<RegistryEntity> findByServiceAndUserAndNotStatus(ServiceEntity service,
UserEntity user, RegistryStatus... status);
List<RegistryEntity> findByUserAndNotStatus(UserEntity user,
RegistryStatus status);
List<RegistryEntity> findRegistriesForDepro(String serviceShortName);
List<RegistryEntity> findByUserAndNotStatus(UserEntity user,
RegistryStatus... status);
}
......@@ -232,16 +232,19 @@ public class JpaRegistryDao extends JpaBaseDao<RegistryEntity, Long> implements
}
@Override
public List<RegistryEntity> findByUserAndNotStatus(UserEntity user, RegistryStatus status) {
public List<RegistryEntity> findByUserAndNotStatus(UserEntity user, RegistryStatus... status) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<RegistryEntity> criteria = builder.createQuery(RegistryEntity.class);
Root<RegistryEntity> root = criteria.from(RegistryEntity.class);
criteria.where(builder.and(
builder.equal(root.get("user"), user)),
builder.notEqual(root.get("registryStatus"), status));
List<Predicate> predList = new ArrayList<Predicate>();
predList.add(builder.equal(root.get("user"), user));
for (RegistryStatus s : status)
predList.add(builder.notEqual(root.get("registryStatus"), s));
criteria.where(builder.and(predList.toArray(new Predicate[]{})));
criteria.select(root);
criteria.distinct(true);
criteria.orderBy(builder.asc(root.get("id")));
return em.createQuery(criteria).getResultList();
}
......
......@@ -10,8 +10,6 @@
******************************************************************************/
package edu.kit.scc.webreg.entity.as;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
......@@ -21,7 +19,6 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
import edu.kit.scc.webreg.entity.AbstractBaseEntity;
import edu.kit.scc.webreg.entity.UserEntity;
@Entity(name = "ASUserAttrValueEntity")
@Table(name = "attribute_src_ua_value")
......
......@@ -55,7 +55,7 @@ public interface RegistryService extends BaseService<RegistryEntity, Long> {
UserEntity user, RegistryStatus... status);
List<RegistryEntity> findByUserAndNotStatus(UserEntity user,
RegistryStatus status);
RegistryStatus... status);
List<RegistryEntity> findRegistriesForDepro(String serviceShortName);
}
......@@ -98,7 +98,7 @@ public class RegistryServiceImpl extends BaseServiceImpl<RegistryEntity, Long> i
}
@Override
public List<RegistryEntity> findByUserAndNotStatus(UserEntity user, RegistryStatus status) {
public List<RegistryEntity> findByUserAndNotStatus(UserEntity user, RegistryStatus... status) {
return dao.findByUserAndNotStatus(user, status);
}
......
......@@ -21,6 +21,7 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import edu.kit.scc.webreg.bootstrap.ApplicationConfig;
import edu.kit.scc.webreg.entity.AdminRoleEntity;
import edu.kit.scc.webreg.entity.ApproverRoleEntity;
import edu.kit.scc.webreg.entity.GroupAdminRoleEntity;
......@@ -71,6 +72,9 @@ public class AuthorizationBean implements Serializable {
@Inject
private GroupService groupService;
@Inject
private ApplicationConfig appConfig;
@PostConstruct
private void init() {
if (sessionManager.getUserId() == null)
......@@ -80,7 +84,7 @@ public class AuthorizationBean implements Serializable {
List<GroupEntity> groupList = groupService.findByUser(user);
String groupString = groupsToString(groupList);
userRegistryList = registryService.findByUserAndNotStatus(user, RegistryStatus.DELETED);
userRegistryList = registryService.findByUserAndNotStatus(user, RegistryStatus.DELETED, RegistryStatus.DEPROVISIONED);
serviceApproverList = new ArrayList<ServiceEntity>();
serviceAdminList = new ArrayList<ServiceEntity>();
......@@ -252,4 +256,8 @@ public class AuthorizationBean implements Serializable {
public List<ServiceEntity> getServiceGroupAdminList() {
return serviceGroupAdminList;
}
public ApplicationConfig getAppConfig() {
return appConfig;
}
}
......@@ -25,6 +25,11 @@
<li><span class="ui-icon ui-icon-star" style="display:inline-block; vertical-align: bottom;" />
<h:link outcome="#{request.contextPath}/user/index.xhtml" value="#{messages.user_properties}" />
</li>
<h:panelGroup rendered="#{authorizationBean.appConfig.getConfigValue('show_user_attribute_source').equalsIgnoreCase('true')}">
<li><span class="ui-icon ui-icon-suitcase" style="display:inline-block; vertical-align: bottom;" />
<h:link outcome="#{request.contextPath}/user/attribute-sources.xhtml" value="#{messages.my_attribute_sources}" />
</li>
</h:panelGroup>
</ul>
</div>
</div>
......
......@@ -25,6 +25,11 @@
<li><span class="ui-icon ui-icon-star" style="display:inline-block; vertical-align: bottom;" />
<h:link outcome="#{request.contextPath}/user/index.xhtml" value="#{messages.user_properties}" />
</li>
<h:panelGroup rendered="#{authorizationBean.appConfig.getConfigValue('show_user_attribute_source').equalsIgnoreCase('true')}">
<li><span class="ui-icon ui-icon-suitcase" style="display:inline-block; vertical-align: bottom;" />
<h:link outcome="#{request.contextPath}/user/attribute-sources.xhtml" value="#{messages.my_attribute_sources}" />
</li>
</h:panelGroup>
</ul>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment