Package evolaris.framework.um.datamodel

Examples of evolaris.framework.um.datamodel.Group


   * @param writeRoles roles a user has to be assigned to in order to write within the blog; may be empty or null
   * @param commentRoles roles a user has to be assigned to in order to comment within the blog; may be empty or null
   * @return the new blog object containing a valid database ID
   */
  public Blog createBlog(String name,  List<Role> readRoles,List<Role> writeRoles,List<Role> commentRoles){
    Group group = mgblGroup();
    Blog blog = new Blog();
    blog.setName(name);
    blog.setGroup(group);
    blog.setCode("blogcode"+(new Date().getTime()));
    PermissionManager permissionManager = new PermissionManager(locale, session);
View Full Code Here


    }
    return article;   
  }
 
  private Blog getGameBlog() {
    Group group = mgblGroup();
    Query q = session.createQuery("from Blog b where b.code=:CODE and b.group=:GROUP");
    q.setParameter("CODE", MGBL_GAMEINSTANCES_BLOG_CODE);
    q.setEntity("GROUP", group);
    try {
      return (Blog)q.list().get(0);
View Full Code Here

        req.getSession().setAttribute("sysMenuItems", displayableMenu);
        if (req.getParameter(DONTGOHOME) == null) {
          gohome = true;
        }
      }
      Group group = webUser.getGroup();
      req.getSession().setAttribute("webUser", webUser)/* in session for same reason as the menu */
      req.getSession().setAttribute("webUserGroup", group.getGroupname())/* for group-specific css; in session for same reason as the menu */
      req.getSession().setAttribute("webUserGroupClientProject", group.getClientProject().getName())/* for clientProject-specific css; in session for same reason as the menu */
     
      // put groups in session for group select box in menu
      GroupManager groupMgr = new GroupManager(locale, session);
      List<String> groups = new ArrayList<String>();
      for (Group g : groupMgr.getGroups()) {
        groups.add(g.getGroupname());
      }
      req.getSession().setAttribute("sysGroupNames", groups);
      if (req.getSession().getAttribute("sysCurrentGroupName") == null) {
        req.getSession().setAttribute("sysCurrentGroupName", group.getGroupname());      
      }     
    } else {
      req.getSession().setAttribute("webUserGroupClientProject", "platform")/* for clientProject-specific css */
    }
    return gohome;
View Full Code Here

   * @param req
   * @return A group or null
   * @throws ConfigurationException if found group does not match the current user's group and the user does not have the ADMINISTRATOR role this Exception is thrown.
   */
  protected Group getCurrentGroup(HttpServletRequest req) {
    Group group = null;
    if (webUser != null) {
      Cookie[] cookies = req.getCookies();
      String groupname = null;
      if (cookies != null){
        for (Cookie c : cookies) {
          if (c.getName().equals("evoplatformgroupname")) {
            groupname = c.getValue();
            break;
          }
        }
      }
      if (groupname == null) {
        groupname = (String)req.getSession().getAttribute("sysCurrentGroupName");
      } else {
        req.getSession().setAttribute("sysCurrentGroupName", groupname);
      }
      if (groupname != null) {
        GroupManager groupMgr = new GroupManager(locale, session);
        group = groupMgr.getGroup(groupname);
        if (group == null) {
          group = webUser.getGroup();
        }
      } else {
        group = webUser.getGroup();
      }
      if (webUser.getGroup().getId() != group.getId() && !req.isUserInRole(UserManagerBase.ADMINISTRATOR)) {
        throw new ConfigurationException("User "+UserManagerBase.toString(webUser) +" must not access group `"+group.getGroupname()+"`");
      }
    }
    return group;
  }
View Full Code Here

   
    UserImportForm userImportForm = (UserImportForm) form;
    if(userImportForm.getMergeSelection() == null || userImportForm.getMergeSelection().equals("")){
      userImportForm.setMergeSelection("none"); // initial setzp
    }
    Group groups[] = null;
    Group groupToDisplay = null;
   
    if (UserManager.isUserInRole(webUser, UserManagerBase.ADMINISTRATOR)) {
      GroupManager groupMgm = new GroupManager(locale,session);
      Long selectedGroupId = userImportForm.getGroupId();
      if (selectedGroupId == null) {
        // set the group name of the administrator group
        groupToDisplay = webUser.getGroup();
      } else {
        groupToDisplay = groupMgm.getGroup(selectedGroupId);
      }
      // set an array of groups into the request
      groups = groupMgm.getGroups();
    } else if (UserManager.isUserInRole(webUser, UserManagerBase.GROUP_ADMINISTRATOR)) {
      // this is a security aspect - > group administartors can only display its own group
      groups = new Group[1];
      Group gr = webUser.getGroup();
      Hibernate.initialize(gr);
      groupToDisplay = webUser.getGroup();
      groups[0] = groupToDisplay;
    } else { // role user - must not be allowed in struts-config
      throw new BugException("illegal role");
View Full Code Here

      String welcomeName = webUser.getUsername();
      if (webUser.getFirstName() != null && webUser.getLastName() != null && (webUser.getFirstName() + webUser.getLastName()).length() >= 3){
        welcomeName = webUser.getFirstName() + " " + webUser.getLastName();
      }
      req.setAttribute("loginName",welcomeName);
      Group group = webUser.getGroup();
      if (group != null && group.getHomePagePath() != null && group.getHomePagePath().trim().length() > 0) {
        String url = getAbsoluteUrl(req, group.getHomePagePath());
        String currentURI = req.getRequestURI();
        if (!url.endsWith(currentURI)) {
          ActionForward fwd = new ActionForward(url);
          fwd.setRedirect(true);
          return fwd;
View Full Code Here

    sender.setMobilkomFreeInterfaceServiceName(f.getMobilkomFreeIFServiceName());
    Set<Group> groups = new HashSet<Group>();
    if (f.getSelectedGroupIds() != null) {
      GroupManager groupManager = new GroupManager(locale,session);
      for (String selectedGroupId : f.getSelectedGroupIds()) {
        Group group = groupManager.getGroup(Long.parseLong(selectedGroupId));
        if (group == null) {
          throw new BugException("illegal group id "+selectedGroupId)// must not happen because groups can not be deleted
        }
        groups.add(group);
      }
View Full Code Here

      if (req.getParameter(DONTGOHOME) == null) {
        gohome = true;
      }     
    }
    req.getSession().setAttribute("language", locale.getLanguage());
    Group group = webUser.getGroup();
    req.getSession().setAttribute("webUser", webUser)/* in session for same reason as the menu */
    req.getSession().setAttribute("webUserGroup", group.getGroupname())/* for group-specific css; in session for same reason as the menu */
    req.getSession().setAttribute("webUserGroupClientProject", group.getClientProject().getName())/* for clientProject-specific css; in session for same reason as the menu */
   
    // put groups in session for group select box in menu
    GroupManager groupMgr = new GroupManager(locale, session);
    List<String> groups = new ArrayList<String>();
    for (Group g : groupMgr.getGroups()) {
View Full Code Here

   * additional checks can be necessary to avoid access to other user's data from a web user without group administrator role
   * @param req  HTTP servlet request
   * @param group  group which the web user tries to access; null => the user tries to access any group (only allowed for administrators)
   */
  protected void checkAccessRights(HttpServletRequest req, Group group) {
    Group webUserGroup = webUser.getGroup();
    if (!req.isUserInRole(UserManagerBase.ADMINISTRATOR) && webUserGroup != group) {     
      throw new InputException(getLocalizedMessage("SystemWeb", "sys.insufficientRights"));
    }   
  }  
View Full Code Here

  /**
   * @see evolaris.framework.sys.web.action.EnterEditDuplicateAction#checkAccessRights(javax.servlet.http.HttpServletRequest, evolaris.framework.um.datamodel.Group, java.lang.Object)
   */
  @Override
  protected void checkAccessRights(HttpServletRequest req, Group group, User entry) {
    Group webUserGroup = webUser.getGroup();
    if (!req.isUserInRole(UserManagerBase.ADMINISTRATOR) && group != webUserGroup){
      throw new InputException(getResources(req).getMessage(locale, "um.insufficientRights"));
    }
    if (entry != null){
      if (!req.isUserInRole(UserManagerBase.GROUP_ADMINISTRATOR) && entry.getId() != webUser.getId()) {
View Full Code Here

TOP

Related Classes of evolaris.framework.um.datamodel.Group

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.