Skip to content

Commit

Permalink
First commit of permissions report (access level summary)
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@3052 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
marcelloscata committed Oct 14, 2004
1 parent 7a7d53a commit 9263459
Show file tree
Hide file tree
Showing 5 changed files with 376 additions and 17 deletions.
226 changes: 226 additions & 0 deletions adm_permissions_report.php
@@ -0,0 +1,226 @@
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: adm_permissions_report.php,v 1.1 2004-10-14 17:34:13 marcelloscata Exp $
# --------------------------------------------------------

require_once( 'core.php' );

$t_core_path = config_get( 'core_path' );

html_page_top1( lang_get( 'permissions_summary_report' ) );
html_page_top2();

print_manage_menu( 'adm_permissions_report.php' );

function get_section_begin( $p_section_name ) {
$t_access_levels = explode_enum_string( config_get( 'access_levels_enum_string' ) );
$t_output = '<table class="width100">';
$t_output .= '<tr><td class="form-title" colspan=' . ( count( $t_access_levels ) + 1 ) . '>' . strtoupper( $p_section_name ) . '</td></tr>' . "\n";
$t_output .= '<tr><td class="form-title" width="40%">' . lang_get( 'perm_rpt_capability' ) . '</td>';
foreach( $t_access_levels as $t_access_level ) {
$t_entry_array = explode_enum_arr( $t_access_level );
$t_output .= '<td class="form-title" style="text-align:center">&nbsp;' . get_enum_to_string( config_get( 'access_levels_enum_string' ), $t_entry_array[0] ) . '&nbsp;</td>';
}
$t_output .= '</tr>' . "\n";

return $t_output;
}

function get_capability_row( $p_caption, $p_access_level ) {
$t_access_levels = explode_enum_string( config_get( 'access_levels_enum_string' ) );

$t_output = '<tr ' . helper_alternate_class() . '><td>' . string_display( $p_caption ) . '</td>';
foreach( $t_access_levels as $t_access_level ) {
$t_entry_array = explode_enum_arr( $t_access_level );

if ( (int)$t_entry_array[0] >= (int)$p_access_level ) {
$t_value = '<img src="images/ok.gif" width=20 height=15 title="X">';
} else {
$t_value = '&nbsp;';
}

$t_output .= '<td class="center">' . $t_value . '</td>';
}

$t_output .= '</tr>' . "\n";

return $t_output;
}

function get_section_end() {
$t_output = '</table><br />' . "\n";
return $t_output;
}

function get_section_begin_for_email( $p_section_name ) {
$t_access_levels = explode_enum_string( config_get( 'access_levels_enum_string' ) );
$t_output = '<table class="width100">';
$t_output .= '<tr><td class="form-title" colspan=' . ( count( $t_access_levels ) + 5 ) . '>' . strtoupper( $p_section_name ) . '</td></tr>' . "\n";
$t_output .= '<tr><td class="form-title" width="30%">Message</td>';
$t_output .= '<td class="form-title" style="text-align:center">&nbsp;reporter&nbsp;</td><td class="form-title" style="text-align:center">&nbsp;handler&nbsp;</td><td class="form-title" style="text-align:center">user<br>&nbsp;monitoring&nbsp;</td><td class="form-title" style="text-align:center">user<br>added<br>&nbsp;bugnote&nbsp;</td>';
foreach( $t_access_levels as $t_access_level ) {
$t_entry_array = explode_enum_arr( $t_access_level );
$t_output .= '<td class="form-title" style="text-align:center">&nbsp;' . get_enum_to_string( config_get( 'access_levels_enum_string' ), $t_entry_array[0] ) . '&nbsp;</td>';
}
$t_output .= '</tr>' . "\n";

return $t_output;
}

function get_capability_row_for_email( $p_caption, $p_message_type ) {
$t_access_levels = explode_enum_string( config_get( 'access_levels_enum_string' ) );

$t_output = '<tr ' . helper_alternate_class() . '><td>' . string_display( $p_caption ) . '</td>';
$t_output .= '<td class="center">' . ( email_notify_flag( $p_message_type, 'reporter' ) ? '<img src="images/ok.gif" width=20 height=15 title="X">' : '&nbsp;' ) . '</td>';
$t_output .= '<td class="center">' . ( email_notify_flag( $p_message_type, 'handler' ) ? '<img src="images/ok.gif" width=20 height=15 title="X">' : '&nbsp;' ) . '</td>';
$t_output .= '<td class="center">' . ( email_notify_flag( $p_message_type, 'monitor' ) ? '<img src="images/ok.gif" width=20 height=15 title="X">' : '&nbsp;' ) . '</td>';
$t_output .= '<td class="center">' . ( email_notify_flag( $p_message_type, 'bugnotes' ) ? '<img src="images/ok.gif" width=20 height=15 title="X">' : '&nbsp;' ) . '</td>';

$t_threshold_min = email_notify_flag( $p_message_type, 'threshold_min' );
$t_threshold_max = email_notify_flag( $p_message_type, 'threshold_max' );

foreach( $t_access_levels as $t_access_level ) {
$t_entry_array = explode_enum_arr( $t_access_level );
if ( ( (int)$t_entry_array[0] >= (int)$t_threshold_min ) &&
( (int)$t_entry_array[0] <= (int)$t_threshold_max ) ) {
$t_value = '<img src="images/ok.gif" width=20 height=15 title="X">';
} else {
$t_value = '&nbsp;';
}
$t_output .= '<td class="center">' . $t_value . '</td>';
}
$t_output .= '</tr>' . "\n";

return $t_output;
}

function get_section_end_for_email() {
$t_output = '</table><br />' . "\n";
return $t_output;
}

echo '<br><br>';

# Issues
echo get_section_begin( lang_get( 'issues' ) );
echo get_capability_row( lang_get( 'report_issue' ), config_get( 'report_bug_threshold' ) );
echo get_capability_row( lang_get( 'update_issue' ), config_get( 'update_bug_threshold' ) );
echo get_capability_row( lang_get( 'monitor_issue' ), config_get( 'monitor_bug_threshold' ) );
echo get_capability_row( lang_get( 'handle_issue' ), config_get( 'handle_bug_threshold' ) );
echo get_capability_row( lang_get( 'move_issue' ), config_get( 'move_bug_threshold' ) );
echo get_capability_row( lang_get( 'delete_issue' ), config_get( 'delete_bug_threshold' ) );
echo get_capability_row( lang_get( 'reopen_issue' ), config_get( 'reopen_bug_threshold' ) );
echo get_capability_row( lang_get( 'view_private_issues' ), config_get( 'private_bug_threshold' ) );
echo get_capability_row( lang_get( 'update_readonly_issues' ), config_get( 'update_readonly_bug_threshold' ) );
echo get_capability_row( lang_get( 'update_issue_status' ), config_get( 'update_bug_status_threshold' ) );
echo get_capability_row( lang_get( 'set_view_status' ), config_get( 'set_view_status_threshold' ) );
echo get_capability_row( lang_get( 'update_view_status' ), config_get( 'change_view_status_threshold' ) );
echo get_capability_row( lang_get( 'show_list_of_users_monitoring_issue' ), config_get( 'show_monitor_list_threshold' ) );
echo get_section_end();

# Notes
echo get_section_begin( lang_get( 'notes' ) );
echo get_capability_row( lang_get( 'add_notes' ), config_get( 'add_bugnote_threshold' ) );
echo get_capability_row( lang_get( 'update_notes' ), config_get( 'update_bugnote_threshold' ) );
echo get_capability_row( lang_get( 'delete_note' ), config_get( 'delete_bugnote_threshold' ) );
echo get_capability_row( lang_get( 'view_private_notes' ), config_get( 'private_bugnote_threshold' ) );
echo get_section_end();

# News
echo get_section_begin( lang_get( 'news' ) );
echo get_capability_row( lang_get( 'view_private_news' ), config_get( 'private_news_threshold' ) );
echo get_capability_row( lang_get( 'manage_news' ), config_get( 'manage_news_threshold' ) );
echo get_section_end();

# Attachments
if( config_get( 'allow_file_upload' ) == ON ) {
echo get_section_begin( lang_get( 'attachments' ) );
echo get_capability_row( lang_get( 'view_list_of_attachments' ), config_get( 'view_attachments_threshold' ) );
echo get_capability_row( lang_get( 'download_attachments' ), config_get( 'download_attachments_threshold' ) );
echo get_capability_row( lang_get( 'delete_attachments' ), config_get( 'delete_attachments_threshold' ) );
echo get_capability_row( lang_get( 'upload_issue_attachments' ), config_get( 'upload_bug_file_threshold' ) );
echo get_section_end();
}

# Filters
echo get_section_begin( lang_get( 'filters' ) );
echo get_capability_row( lang_get( 'save_filters' ), config_get( 'stored_query_create_threshold' ) );
echo get_capability_row( lang_get( 'save_filters_as_shared' ), config_get( 'stored_query_create_shared_threshold' ) );
echo get_capability_row( lang_get( 'use_saved_filters' ), config_get( 'stored_query_use_threshold' ) );
echo get_section_end();

# Projects
echo get_section_begin( lang_get( 'projects_link' ) );
echo get_capability_row( lang_get( 'create_project' ), config_get( 'create_project_threshold' ) );
echo get_capability_row( lang_get( 'delete_project' ), config_get( 'delete_project_threshold' ) );
echo get_capability_row( lang_get( 'manage_projects_link' ), config_get( 'manage_project_threshold' ) );
echo get_capability_row( lang_get( 'manage_user_access_to_project' ), config_get( 'project_user_threshold' ) );
echo get_capability_row( lang_get( 'automatically_included_in_private_projects' ), config_get( 'private_project_threshold' ) );
echo get_section_end();

# Project Documents
if( config_get( 'enable_project_documentation' ) == ON ) {
echo get_section_begin( lang_get( 'project_documents' ) );
echo get_capability_row( lang_get( 'view_project_documents' ), config_get( 'view_proj_doc_threshold' ) );
echo get_capability_row( lang_get( 'upload_project_documents' ), config_get( 'upload_project_file_threshold' ) );
echo get_section_end();
}

# Custom Fields
echo get_section_begin( lang_get( 'custom_fields_setup' ) );
echo get_capability_row( lang_get( 'manage_custom_field_link' ), config_get( 'manage_custom_fields_threshold' ) );
echo get_capability_row( lang_get( 'link_custom_fields_to_projects' ), config_get( 'custom_field_link_threshold' ) );
echo get_section_end();

# Sponsorships
if( config_get( 'enable_sponsorship' ) == ON ) {
echo get_section_begin( lang_get( 'sponsorships' ) );
echo get_capability_row( lang_get( 'view_sponsorship_details' ), config_get( 'view_sponsorship_details_threshold' ) );
echo get_capability_row( lang_get( 'view_sponsorship_total' ), config_get( 'view_sponsorship_total_threshold' ) );
echo get_capability_row( lang_get( 'sponsor_issue' ), config_get( 'sponsor_threshold' ) );
echo get_capability_row( lang_get( 'assign_sponsored_issue' ), config_get( 'assign_sponsored_bugs_threshold' ) );
echo get_capability_row( lang_get( 'handle_sponsored_issue' ), config_get( 'handle_sponsored_bugs_threshold' ) );
echo get_section_end();
}

# Others
echo get_section_begin( 'OTHERS' );
echo get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'summary_link' ), config_get( 'view_summary_threshold' ) );
echo get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'changelog_link' ), config_get( 'view_changelog_threshold' ) );
echo get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'assigned_to' ), config_get( 'view_handler_threshold' ) );
echo get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'bug_history' ), config_get( 'view_history_threshold' ) );
echo get_capability_row( lang_get( 'see_email_addresses_of_other_users' ), config_get( 'show_user_email_threshold' ) );
echo get_capability_row( lang_get( 'send_reminders' ), config_get( 'bug_reminder_threshold' ) );
echo get_capability_row( lang_get( 'add_profiles' ), config_get( 'add_profile_threshold' ) );
echo get_capability_row( lang_get( 'manage_users_link' ), config_get( 'manage_user_threshold' ) );
echo get_capability_row( lang_get( 'notify_of_new_user_created' ), config_get( 'notify_new_user_created_threshold_min' ) );
echo get_section_end();

# Email notifications
if( config_get( 'enable_email_notification' ) == ON ) {
echo get_section_begin_for_email( lang_get( 'email_notification' ) );
echo get_capability_row_for_email( lang_get( 'email_on_new' ), 'new' );
echo get_capability_row_for_email( lang_get( 'email_on_assigned' ), 'owner' );
echo get_capability_row_for_email( lang_get( 'email_on_reopened' ), 'reopen' );
echo get_capability_row_for_email( lang_get( 'email_on_deleted' ), 'deleted' );
echo get_capability_row_for_email( lang_get( 'email_on_bugnote_added' ), 'bugnote' );
echo get_capability_row_for_email( lang_get( 'email_on_sponsorship_changed' ), 'sponsor' );
echo get_capability_row_for_email( lang_get( 'email_on_relationship_changed' ), 'relationship' );

$t_statuses = explode_enum_string( config_get( 'status_enum_string' ) );
foreach( $t_statuses as $t_status ) {
list( $t_state, $t_label ) = explode_enum_arr( $t_status );
echo get_capability_row_for_email( lang_get( 'status_changed_to' ) . ' \'' . get_enum_element( 'status', $t_state ) . '\'', $t_label );
}

echo get_section_end_for_email();
}

html_page_bottom1( __FILE__ );
?>
27 changes: 21 additions & 6 deletions core/html_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: html_api.php,v 1.136 2004-10-02 14:53:02 thraxisp Exp $
# $Id: html_api.php,v 1.137 2004-10-14 17:34:13 marcelloscata Exp $
# --------------------------------------------------------

###########################################################################
Expand Down Expand Up @@ -528,17 +528,29 @@ function print_menu_graph() {
# --------------------
# Print the menu for the manage section
# $p_page specifies the current page name so it's link can be disabled
function print_manage_menu( $p_page='' ) {
function print_manage_menu( $p_page = '' ) {
$t_manage_user_page = 'manage_user_page.php';
$t_manage_project_menu_page = 'manage_proj_page.php';
$t_manage_custom_field_page = 'manage_custom_field_page.php';
$t_permissions_summary_report = 'adm_permissions_report.php';
# $t_documentation_page = 'documentation_page.php';

switch ( $p_page ) {
case $t_manage_user_page : $t_manage_user_page = ''; break;
case $t_manage_project_menu_page: $t_manage_project_menu_page = ''; break;
case $t_manage_custom_field_page: $t_manage_custom_field_page = ''; break;
# case $t_documentation_page : $t_documentation_page = ''; break;
case $t_manage_user_page:
$t_manage_user_page = '';
break;
case $t_manage_project_menu_page:
$t_manage_project_menu_page = '';
break;
case $t_manage_custom_field_page:
$t_manage_custom_field_page = '';
break;
case $t_permissions_summary_report:
$t_permissions_summary_report = '';
break;
case $t_documentation_page:
$t_documentation_page = '';
break;
}

PRINT '<br /><div align="center">';
Expand All @@ -550,6 +562,9 @@ function print_manage_menu( $p_page='' ) {
}
if ( access_has_project_level( config_get( 'manage_custom_fields_threshold' ) ) ) {
print_bracket_link( $t_manage_custom_field_page, lang_get( 'manage_custom_field_link' ) );
}
if ( access_has_project_level( ADMINISTRATOR ) ) {
print_bracket_link( $t_permissions_summary_report, lang_get( 'permissions_summary_report' ) );
}
# print_bracket_link( $t_documentation_page, lang_get( 'documentation_link' ) );
PRINT '</div>';
Expand Down
Binary file added images/ok.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 65 additions & 6 deletions lang/strings_english.txt
Expand Up @@ -9,14 +9,13 @@
###########################################################################
# English strings for Mantis
# -------------------------------------------------
# $Revision: 1.217 $
# $Author: prichards $
# $Date: 2004-10-05 21:12:13 $
# $Revision: 1.218 $
# $Author: marcelloscata $
# $Date: 2004-10-14 17:34:14 $
#
# $Id: strings_english.txt,v 1.217 2004-10-05 21:12:13 prichards Exp $
# $Id: strings_english.txt,v 1.218 2004-10-14 17:34:14 marcelloscata Exp $
###########################################################################
?>
<?php

# Charset
$s_charset = 'windows-1252';

Expand Down Expand Up @@ -608,6 +607,7 @@ $s_filter_button = 'Apply Filter';
$s_manage_users_link = 'Manage Users';
$s_manage_projects_link = 'Manage Projects';
$s_manage_custom_field_link = 'Manage Custom Fields';
$s_permissions_summary_report = 'Permissions Report';
$s_create_new_account_link = 'Create New Account';
$s_projects_link = 'Projects';
$s_documentation_link = 'Documentation';
Expand Down Expand Up @@ -1080,4 +1080,63 @@ $s_view_issue = "View Issue";

# Source Control Integration
$s_checkin = 'Checkin';

# Pemissions report
$s_perm_rpt_capability = 'Capability';
$s_view = 'View';
$s_issues = 'ISSUES';
$s_report_issue = 'Report an issue';
$s_update_issue = 'Update an issue';
$s_monitor_issue = 'Monitor an issue';
$s_handle_issue = 'Handle an issue';
$s_move_issue = 'Move an issue';
$s_delete_issue = 'Delete an issue';
$s_reopen_issue = 'Reopen an issue';
$s_view_private_issues = 'View private issues';
$s_update_readonly_issues = 'Update readonly issues';
$s_update_issue_status = 'Update issue status';
$s_set_view_status = 'Set view status (public vs private)';
$s_update_view_status = 'Update view status (public vs private)';
$s_show_list_of_users_monitoring_issue = 'Show list of users monitoring issue';
$s_notes = 'NOTES';
$s_add_notes = 'Add notes';
$s_update_notes = 'Update notes';
$s_delete_note = 'Delete note';
$s_view_private_notes = 'View private notes';
$s_news = 'NEWS';
$s_view_private_news = 'View private news';
$s_manage_news = 'Manage news';
$s_view_list_of_attachments = 'View list of attachments';
$s_download_attachments = 'Download attachments';
$s_delete_attachments = 'Delete attachments';
$s_upload_issue_attachments = 'Upload issue attachments';
$s_filters = 'filters';
$s_save_filters = 'Save filters';
$s_save_filters_as_shared = 'Save filters as shared';
$s_use_saved_filters = 'Use saved filters';
$s_create_project = 'Create project';
$s_delete_project = 'Delete project';
$s_manage_project = 'Manage project';
$s_manage_user_access_to_project = 'Manage user access to a project';
$s_automatically_included_in_private_projects = 'Automatically included in private projects';
$s_project_documents = 'PROJECT DOCUMENTS';
$s_view_project_documents = 'View project documents';
$s_upload_project_documents = 'Upload project documents';
$s_link_custom_fields_to_projects = 'Link custom fields to projects';
$s_sponsorships = 'SPONSORSHIPS';
$s_view_sponsorship_details = 'View sponsorship details';
$s_view_sponsorship_total = 'View sponsorship total';
$s_sponsor_issue = 'Sponsor issue';
$s_assign_sponsored_issue = 'Assign sponsored issue';
$s_handle_sponsored_issue = 'Handle sponsored issue';
$s_others = 'OTHERS';
$s_see_email_addresses_of_other_users = 'See email addresses of other users';
$s_send_reminders = 'Send reminders';
$s_add_profiles = 'Add profiles';
$s_notify_of_new_user_created = 'Notify of new user created';
$s_email_notification = 'EMAIL NOTIFICATION';
$s_status_changed_to = 'Status changes to';
$s_email_on_deleted = 'Email on Deleted';
$s_email_on_sponsorship_changed = 'Email on Sponsorship changed';
$s_email_on_relationship_changed = 'Email on Relationship changed';
?>

0 comments on commit 9263459

Please sign in to comment.