Search in sources :

Example 1 with UserGroupPrivacyBlock

use of net.sourceforge.processdash.team.group.UserGroupPrivacyBlock in project processdash by dtuma.

the class EVReportSettings method checkPersonalDataPermission.

/**
     * If a filter is in place, check to see whether it violates a data privacy
     * permission. If so, install a "privacy block" group filter.
     * 
     * @param evModel
     *            the earned value task list, to which any filtering has already
     *            been applied
     * @param permissionID
     *            the ID of a data privacy permission to check
     */
public void checkPersonalDataPermission(EVTaskListRollup evModel, String permissionID) {
    // if no user filter is in place, or if it's already a block, return.
    if (userGroupFilter == null || userGroupFilter instanceof UserGroupPrivacyBlock)
        return;
    // see if the model contains data for only one person. If not, we're OK
    String personalDataID = evModel.getPersonalDataID();
    if (personalDataID == null)
        return;
    // if we've been granted permission to see this person's data, we're OK
    UserFilter pf = GroupPermission.getGrantedMembers(permissionID);
    EVTaskListFilter tlf = new EVTaskListGroupFilter(pf);
    if (tlf.include(personalDataID))
        return;
    // install a data privacy block filter to protect personal data.
    userGroupFilter = new UserGroupPrivacyBlock(userGroupFilter);
    evModel.applyTaskListFilter(new EVTaskListGroupFilter(userGroupFilter));
}
Also used : EVTaskListFilter(net.sourceforge.processdash.ev.EVTaskListFilter) EVTaskListGroupFilter(net.sourceforge.processdash.ev.EVTaskListGroupFilter) UserFilter(net.sourceforge.processdash.team.group.UserFilter) UserGroupPrivacyBlock(net.sourceforge.processdash.team.group.UserGroupPrivacyBlock)

Example 2 with UserGroupPrivacyBlock

use of net.sourceforge.processdash.team.group.UserGroupPrivacyBlock in project processdash by dtuma.

the class PlanSummaryNameHeader method writeUserGroupIcon.

/** Print text and icon for choosing a user group
     */
private void writeUserGroupIcon(String projectRoot) {
    if (!UserGroupManager.getInstance().isFilteringAvailable())
        return;
    boolean exporting = isExporting();
    if (!exporting)
        writeHyperlink("selectGroupFilter", getSnippetParams(false, false));
    // retrieve information about the filter that is in effect
    UserFilter f = UserGroupManagerDash.getInstance().getLocalFilter(projectRoot);
    boolean isPrivacyViolation = f instanceof UserGroupPrivacyBlock;
    // display an icon to represent this group filter
    out.print("<img border='0' src='/Images/userGroup");
    if (isPrivacyViolation)
        out.print("Privacy");
    else if (f instanceof UserGroupMember)
        out.print("Member");
    out.print(".png' ");
    if (isPrivacyViolation)
        out.print("title='Group filter blocked to protect data privacy' ");
    else if (!exporting)
        out.print("title='Filter to group' ");
    else if (!UserGroup.isEveryone(f))
        out.print("title='Group filter is in effect' ");
    out.print("style='margin: 0px 2px 0px 10px; position:relative; top:3px; width:22px; height:22px'>");
    if (!exporting)
        out.print("</a>");
    // display the name of the filter
    if (isPrivacyViolation)
        out.print("<span style='color:#888; font-weight:normal; text-decoration:line-through'>");
    out.print(HTMLUtils.escapeEntities(f.toString()));
    if (isPrivacyViolation)
        out.print("</span>");
    // display form elements to refresh the page as needed
    out.print("<input type='hidden' name='[DB_User_Group/Name]!'>");
    out.print("<input type='hidden' name='[User_Group/Privacy_Violation]!'>");
}
Also used : UserFilter(net.sourceforge.processdash.team.group.UserFilter) UserGroupPrivacyBlock(net.sourceforge.processdash.team.group.UserGroupPrivacyBlock) UserGroupMember(net.sourceforge.processdash.team.group.UserGroupMember)

Example 3 with UserGroupPrivacyBlock

use of net.sourceforge.processdash.team.group.UserGroupPrivacyBlock in project processdash by dtuma.

the class EVReport method printFilterInfo.

public static void printFilterInfo(PrintWriter out, EVTaskFilter filter, EVReportSettings settings, boolean exporting, boolean textOnly) {
    String labelFilter = (filter == null ? null : filter.getAttribute(EVLabelFilter.LABEL_FILTER_ATTR));
    String pathFilter = (filter == null ? null : filter.getAttribute(EVHierarchicalFilter.HIER_FILTER_ATTR));
    UserFilter groupFilter = (settings == null ? null : settings.getUserGroupFilter());
    if (labelFilter == null && pathFilter == null && groupFilter == null)
        return;
    out.print("<h2 style='position:relative; left:-10px'>");
    if (labelFilter != null) {
        if (!textOnly)
            out.print("<img border=0 src='/Images/filter.png' " + "style='margin: 0px 2px 0px 10px; position:relative; top:3px' " + "width='16' height='23' title=\"");
        out.print(resources.getHTML("Report.Filter_Tooltip"));
        out.print(textOnly ? " - " : "\">");
        out.print(HTMLUtils.escapeEntities(labelFilter));
    }
    if (pathFilter != null) {
        if (!textOnly)
            out.print("<img border=0 src='/Images/hier.png' " + "style='margin: 0px 2px 0px 10px; position:relative; top:3px' " + "width='16' height='23' title=\"");
        out.print(resources.getHTML("Report.Filter_Tooltip"));
        out.print(textOnly ? " - " : "\">");
        out.print(HTMLUtils.escapeEntities(pathFilter));
    }
    if (groupFilter != null) {
        boolean isPrivacyViolation = groupFilter instanceof UserGroupPrivacyBlock;
        // display an icon to represent this group filter
        if (!textOnly) {
            boolean showGroupHyperlink = !exporting && (settings.getParameters().containsKey(//
            EVReportSettings.GROUP_FILTER_PARAM) || settings.getParameters().containsKey(EVReportSettings.GROUP_FILTER_AUTO_PARAM));
            if (showGroupHyperlink)
                out.print("<a href='../team/setup/selectGroupFilter'>");
            out.print("<img border=0 src='/Images/userGroup");
            if (isPrivacyViolation)
                out.print("Privacy");
            else if (groupFilter instanceof UserGroupMember)
                out.print("Member");
            out.print(".png' ");
            if (isPrivacyViolation)
                out.print("title='Group filter blocked to protect data privacy' ");
            else if (showGroupHyperlink)
                out.print("title='Filter to group' ");
            out.print("style='margin: 0px 2px 0px 10px; position:relative; top:3px' " + "width='23' height='23'>");
            if (showGroupHyperlink)
                out.print("</a>");
        }
        // display the name of the filter
        if (isPrivacyViolation)
            out.print("<span style='color:#888; font-weight:normal; text-decoration:line-through'>");
        out.print(HTMLUtils.escapeEntities(groupFilter.toString()));
        if (isPrivacyViolation)
            out.print("</span>");
    }
    out.println("</h2>");
}
Also used : UserFilter(net.sourceforge.processdash.team.group.UserFilter) UserGroupPrivacyBlock(net.sourceforge.processdash.team.group.UserGroupPrivacyBlock) UserGroupMember(net.sourceforge.processdash.team.group.UserGroupMember)

Example 4 with UserGroupPrivacyBlock

use of net.sourceforge.processdash.team.group.UserGroupPrivacyBlock in project processdash by dtuma.

the class EVReportSettings method getUserGroupFilter.

/**
     * Get the user group filter that should be used to display the report.
     */
public UserFilter getUserGroupFilter() {
    if (!UserGroupManager.getInstance().isFilteringAvailable() || Boolean.FALSE.equals(isRollup))
        return null;
    if (userGroupFilter != null)
        return userGroupFilter;
    String filterID = getParameter(GROUP_FILTER_PARAM);
    UserFilter f = UserGroupManager.getInstance().getFilterById(filterID);
    if (f == null)
        f = UserGroup.EVERYONE;
    else if (UserGroupManagerDash.getInstance().isPrivacyViolation(prefix))
        f = new UserGroupPrivacyBlock(f);
    userGroupFilter = f;
    return f;
}
Also used : UserFilter(net.sourceforge.processdash.team.group.UserFilter) UserGroupPrivacyBlock(net.sourceforge.processdash.team.group.UserGroupPrivacyBlock)

Aggregations

UserFilter (net.sourceforge.processdash.team.group.UserFilter)4 UserGroupPrivacyBlock (net.sourceforge.processdash.team.group.UserGroupPrivacyBlock)4 UserGroupMember (net.sourceforge.processdash.team.group.UserGroupMember)2 EVTaskListFilter (net.sourceforge.processdash.ev.EVTaskListFilter)1 EVTaskListGroupFilter (net.sourceforge.processdash.ev.EVTaskListGroupFilter)1