Package org.projectforge.access

Examples of org.projectforge.access.GroupTaskAccessDO


   * @see AccessType
   * @see OperationType
   */
  public boolean hasPermission(final Integer groupId, final AccessType accessType, final OperationType opType)
  {
    final GroupTaskAccessDO groupAccess = getGroupTaskAccess(groupId);
    if (groupAccess == null) {
      if (parent != null) {
        return parent.isPermissionRecursive(groupId) && parent.hasPermission(groupId, accessType, opType);
      }
      // This is the root node.
      return false;
    }
    return groupAccess.hasPermission(accessType, opType);
  }
View Full Code Here


    return groupAccess.hasPermission(accessType, opType);
  }

  public boolean isPermissionRecursive(final Integer groupId)
  {
    final GroupTaskAccessDO groupAccess = getGroupTaskAccess(groupId);
    return groupAccess == null || groupAccess.isRecursive() == true;
  }
View Full Code Here

    Validate.notNull(groupId);
    boolean result = false;
    synchronized (groupTaskAccessList) {
      final Iterator<GroupTaskAccessDO> it = groupTaskAccessList.iterator();
      while (it.hasNext() == true) {
        final GroupTaskAccessDO access = it.next();
        if (groupId.equals(access.getGroupId()) == true) {
          it.remove();
          result = true;
        }
      }
    }
View Full Code Here

    final List<IColumn<GroupTaskAccessDO, String>> columns = new ArrayList<IColumn<GroupTaskAccessDO, String>>();
    final CellItemListener<GroupTaskAccessDO> cellItemListener = new CellItemListener<GroupTaskAccessDO>() {
      public void populateItem(final Item<ICellPopulator<GroupTaskAccessDO>> item, final String componentId,
          final IModel<GroupTaskAccessDO> rowModel)
      {
        final GroupTaskAccessDO acces = rowModel.getObject();
        appendCssClasses(item, acces.getId(), acces.isDeleted());
      }
    };
    columns.add(new CellItemListenerPropertyColumn<GroupTaskAccessDO>(new Model<String>(getString("task")), getSortable("task.title",
        sortable), "task.title", cellItemListener) {
      /**
       * @see org.projectforge.web.wicket.CellItemListenerPropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item,
       *      java.lang.String, org.apache.wicket.model.IModel)
       */
      @Override
      public void populateItem(final Item<ICellPopulator<GroupTaskAccessDO>> item, final String componentId,
          final IModel<GroupTaskAccessDO> rowModel)
      {
        final GroupTaskAccessDO access = rowModel.getObject();
        final TaskDO task = access.getTask();
        final StringBuffer buf = new StringBuffer();
        taskFormatter.appendFormattedTask(getRequestCycle(), buf, task, true, false);
        final Label formattedTaskLabel = new Label(ListSelectActionPanel.LABEL_ID, buf.toString());
        formattedTaskLabel.setEscapeModelStrings(false);
        item.add(new ListSelectActionPanel(componentId, rowModel, AccessEditPage.class, access.getId(), returnToPage, formattedTaskLabel));
        addRowClick(item);
        cellItemListener.populateItem(item, componentId, rowModel);
      }
    });
    columns.add(new CellItemListenerPropertyColumn<GroupTaskAccessDO>(new Model<String>(getString("group")), getSortable("group.name",
        sortable), "group.name", cellItemListener));
    columns.add(new CellItemListenerPropertyColumn<GroupTaskAccessDO>(new Model<String>(getString("recursive")), getSortable("recursive",
        sortable), "recursive", cellItemListener) {
      @Override
      public void populateItem(final Item<ICellPopulator<GroupTaskAccessDO>> item, final String componentId,
          final IModel<GroupTaskAccessDO> rowModel)
      {
        final GroupTaskAccessDO access = rowModel.getObject();
        if (access.isRecursive() == true) {
          item.add(new IconPanel(componentId, IconType.ACCEPT));
        } else {
          item.add(createInvisibleDummyComponent(componentId));
        }
        cellItemListener.populateItem(item, componentId, rowModel);
      }
    });
    columns.add(new CellItemListenerPropertyColumn<GroupTaskAccessDO>(new Model<String>(getString("access.type")), null, "accessEntries",
        cellItemListener) {
      @Override
      public void populateItem(final Item<ICellPopulator<GroupTaskAccessDO>> item, final String componentId,
          final IModel<GroupTaskAccessDO> rowModel)
      {
        final int rowIndex = ((Item< ? >) item.findParent(Item.class)).getIndex();
        final GroupTaskAccessDO access = rowModel.getObject();
        final List<AccessEntryDO> accessEntries = access.getOrderedEntries();
        final AccessTablePanel accessTablePanel = new AccessTablePanel(componentId, accessEntries);
        if (rowIndex == 0) {
          accessTablePanel.setDrawHeader(true);
        }
        item.add(accessTablePanel);
        accessTablePanel.init();
        cellItemListener.populateItem(item, componentId, rowModel);
      }
    });
    columns.add(new CellItemListenerPropertyColumn<GroupTaskAccessDO>(getString("description"), getSortable("description", sortable),
        "description", cellItemListener) {
      @Override
      public void populateItem(final Item<ICellPopulator<GroupTaskAccessDO>> item, final String componentId,
          final IModel<GroupTaskAccessDO> rowModel)
      {
        final GroupTaskAccessDO access = rowModel.getObject();
        final Label label = new Label(componentId, StringUtils.abbreviate(access.getDescription(), 100));
        cellItemListener.populateItem(item, componentId, rowModel);
        item.add(label);
      }
    });
    return columns;
View Full Code Here

  {
    final String tutorialReference = getTutorialReference(reference);
    if (doesEntryAlreadyExist(accessDao, tutorialReference) == true) {
      return;
    }
    final GroupTaskAccessDO access;
    TaskDO task = null;
    GroupDO group = null;
    if ("JavaGurusEmployees".equals(reference) == true) {
      task = getRequiredTask(REF_TASK_JAVA_GURUS);
      group = getRequiredGroup(REF_GROUP_JAVA_GURUS);
View Full Code Here

    setResponsePage(accessEditPage);
  }

  private GroupTaskAccessDO createAccess(final TaskDO task, final GroupDO group, final String template, final String description)
  {
    final GroupTaskAccessDO access = new GroupTaskAccessDO();
    access.setTask(task);
    access.setGroup(group);
    if (ACCESS_TEMPLATE_EMPLOYEE.equals(template) == true) {
      access.employee();
    }
    access.setDescription(description);
    return access;
  }
View Full Code Here

  public GroupTaskAccessDO createGroupTaskAccess(final GroupDO group, final TaskDO task)
  {
    Validate.notNull(group);
    Validate.notNull(task);
    final GroupTaskAccessDO access = new GroupTaskAccessDO();
    access.setGroup(group);
    access.setTask(task);
    accessDao.internalSave(access);
    return access;
  }
View Full Code Here

  }

  public GroupTaskAccessDO createGroupTaskAccess(final GroupDO group, final TaskDO task, final AccessType accessType,
      final boolean accessSelect, final boolean accessInsert, final boolean accessUpdate, final boolean accessDelete)
  {
    final GroupTaskAccessDO access = createGroupTaskAccess(group, task);
    final AccessEntryDO entry = access.ensureAndGetAccessEntry(accessType);
    entry.setAccess(accessSelect, accessInsert, accessUpdate, accessDelete);
    accessDao.internalUpdate(access);
    return access;
  }
View Full Code Here

    return access;
  }

  private void initAccess()
  {
    GroupTaskAccessDO access = createGroupTaskAccess(getGroup("group1"), getTask("1"));
    final AccessEntryDO entry = access.ensureAndGetAccessEntry(AccessType.TASKS);
    entry.setAccess(true, true, true, true);
    accessDao.internalUpdate(access);

    // Create some test tasks with test access:
    addTask("testAccess", "root");
View Full Code Here

      return;
    }
    if (taskDao.getTaskTree().isRootNode(taskNode) == true) {
      return;
    }
    GroupTaskAccessDO access = accessDao.getEntry(taskNode.getTask(), group);
    if (access == null) {
      access = new GroupTaskAccessDO();
      accessDao.setTask(access, taskNode.getId());
      accessDao.setGroup(access, group.getId());
    } else {
      if (access.isDeleted() == true) {
        accessDao.undelete(access);
      }
    }
    if (isLeaf == false) {
      access.guest();
      access.setRecursive(false);
    } else if (isManagerGroup) {
      access.leader();
      access.setRecursive(true);
    } else {
      access.employee();
      access.setRecursive(true);
    }
    accessDao.saveOrUpdate(access);
    createAccessRights(taskNode.getParent(), group, isManagerGroup, false);
  }
View Full Code Here

TOP

Related Classes of org.projectforge.access.GroupTaskAccessDO

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.