Plugin Directory

Changeset 2038744


Ignore:
Timestamp:
02/25/2019 10:56:24 AM (7 years ago)
Author:
themexa
Message:

Version 2.0 - User Role wise Permission Feature Added

Location:
secure-file-manager
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • secure-file-manager/trunk/assets/admin/css/cosmostrap.css

    r2034959 r2038744  
    15911591.tx_wrap .form-check-label {
    15921592  margin-bottom: 0;
     1593  margin-left: 20px;
    15931594}
    15941595.tx_wrap .form-check-inline {
     
    73207321  height: auto;
    73217322  width: auto;
     7323  margin-left: 0px;
    73227324}
    73237325.tx_wrap input[type=radio] {
  • secure-file-manager/trunk/includes/activation.php

    r2034959 r2038744  
    33 * Execute the following code during plugin activation
    44 *
    5  * @since      1.0
     5 * @since      2.0
    66 * @package    Secure File Manager
    77 * @author     Themexa
    88 */
     9
     10if ( empty( get_option( 'sfm_auth_roles' ) ) ) {
     11    update_option ( 'sfm_auth_roles', explode( ',', 'administrator' ) );
     12}
  • secure-file-manager/trunk/includes/admin.php

    r2035139 r2038744  
    33 * Code for Admin Options
    44 *
    5  * @since      1.0
     5 * @since      2.0
    66 * @package    Secure File Manager
    77 * @author     Themexa
     
    1212    $page_title = __( 'Secure File Manager', 'secure-file-manager' );
    1313    $menu_title = __( 'Secure File Manager', 'secure-file-manager' );
    14     $capability = 'manage_options';
     14    $capability = 'read';
    1515    $menu_slug = 'sfm_file_manager';
    1616    $function = 'sfm_file_manager_display';
     
    2626        __( 'Settings', 'secure-file-manager' ),
    2727        __( 'Settings', 'secure-file-manager' ),
    28         'manage_options',
     28        'read',
    2929        'sfm_settings',
    3030        'sfm_settings_display'
     
    3434function sfm_file_manager_display() {
    3535
    36     if ( ! current_user_can( 'manage_options' ) ) {
    37         wp_die( 'Unauthorized user' );
    38     } elseif ( get_option( 'scp_auth_user' ) ) {
    39         $userID = intval( get_option( 'scp_auth_user' ) );
     36    if ( get_option( 'sfm_auth_user' ) ) {
    4037        $currentUser = get_current_user_id();
    41         if ( $currentUser != $userID ) {
     38        $currentUserRole = wp_get_current_user();
     39        $roles = ( array ) $currentUserRole->roles;
     40
     41        if ( ! (current_user_can('update_core') || in_array( $currentUser, get_option( 'sfm_auth_user' ) ) || array_intersect( get_option( 'sfm_auth_roles' ), $roles ) ) ) {
    4242            wp_die( '<h1>Unauthorized Access. Please contact Site Administrator.</h1>' );
    4343        }
    4444    }
    45 
    4645
    4746?>
     
    5049            <div class="row">
    5150                <div class="col-lg-12">
    52                     <div class="jumbotron" style="background-image: url(<?php echo plugin_dir_url( dirname( __FILE__ ) ); ?>assets/images/tinypixi_pluginman_head.png); ">
     51                    <div class="jumbotron" style="background-image: url( <?php echo plugin_dir_url( dirname( __FILE__ ) ); ?>assets/images/tinypixi_pluginman_head.png ); ">
    5352                        <h1 class="display-3"><?php _e( 'Secure File Manager', 'secure-file-manager' ); ?></h1>
    5453                        <p class="lead"><?php _e( 'WordPress file editing made easy (and secure)', 'bwpse' ); ?></p>
     
    6766
    6867    if ( ! current_user_can( 'manage_options' ) ) {
    69         wp_die( 'Unauthorized user' );
    70     } elseif ( get_option( 'scp_auth_user' ) ) {
    71         $userID = intval( get_option( 'scp_auth_user' ) );
    72         $currentUser = get_current_user_id();
    73         if ( $currentUser != $userID ) {
    74             wp_die( '<h1>Unauthorized Access. Please contact Site Administrator.</h1>' );
    75         }
     68        wp_die( '<h1>Unauthorized Access. Please contact Site Administrator.</h1>' );
    7669    }
    7770
     
    8275            <div class="row">
    8376                <div class="col-lg-12">
    84                     <div class="jumbotron" style="background-image: url(<?php echo plugin_dir_url( dirname( __FILE__ ) ); ?>assets/images/tinypixi_pluginman_head.png); ">
     77                    <div class="jumbotron" style="background-image: url( <?php echo plugin_dir_url( dirname( __FILE__ ) ); ?>assets/images/tinypixi_pluginman_head.png ); ">
    8578                        <h1 class="display-3"><?php _e( 'Secure File Manager', 'secure-file-manager' ); ?></h1>
    8679                        <p class="lead"><?php _e( 'Settings', 'bwpse' ); ?></p>
     
    8881                </div>
    8982            </div>
    90             <form method="post">
    91                 <h1><?php _e( 'Security', 'secure-file-manager' ); ?></h1>
    92                 <fieldset id="scp_auth_user">
    93                     <div class="form-group">
    94                         <?php
    95                             if ( isset( $_POST[ 'scp_auth_user' ] ) ) {
    96                                 update_option( 'scp_auth_user', intval($_POST['scp_auth_user']) );
    97                             }
    98                         ?>
    99                         <label><?php _e( 'Which user should have access to the File Manager?', 'secure-file-manager' ); ?></label>
    100                         <input type="number" name="scp_auth_user" id="scp_auth_user" placeholder="e.g. 1" class="form-control" value="<?php echo get_option( 'scp_auth_user' ); ?>">
    101                         <small class="form-text text-muted"><?php _e( 'Enter specific user ID', 'secure-file-manager' ); ?></small>
    102                     </div>
    103                 </fieldset>
    104                 <fieldset>
    105                     <input type="hidden" name="action" value="update" />
    106                     <?php wp_nonce_field('scp_update_action'); ?>
    107                     <button type="submit" class="btn btn-primary"><?php _e( 'Save Changes', 'secure-file-manager' ); ?></button>
    108                 </fieldset>
    109             </form>
     83            <div class="row">
     84                <div class="col-md-6">
     85                    <form method="post">
     86                        <h1><?php _e( 'Limit with User ID(s)', 'secure-file-manager' ); ?></h1>
     87                        <fieldset id="sfm_auth_user">
     88                            <div class="form-group">
     89                                <?php
     90                                    if ( isset( $_POST[ 'sfm_auth_user' ] ) ) {
     91                                        update_option( 'sfm_auth_user', preg_replace( array( '/[^\d,]/', '/(?<=,),+/', '/^,+/', '/,+$/' ), '', explode( ',', $_POST[ 'sfm_auth_user' ] ) ) );
     92                                    }
     93                                ?>
     94                                <strong><label><?php _e( 'Which user should have access to the File Manager?', 'secure-file-manager' ); ?></label></strong>
     95                                <input type="text" name="sfm_auth_user" id="sfm_auth_user" placeholder="e.g. 1, 2, 3" class="form-control" value="<?php echo implode(', ',get_option( 'sfm_auth_user' )); ?>">
     96                                <small class="form-text text-muted"><?php _e( 'Enter specific user ID. Enter comma ( , ) between IDs if there are more than one.', 'secure-file-manager' ); ?></small>
     97                            </div>
     98                        </fieldset>
     99                        <fieldset>
     100                            <input type="hidden" name="action" value="update" />
     101                            <?php wp_nonce_field('sfm_update_action'); ?>
     102                            <button type="submit" class="btn btn-primary"><?php _e( 'Save Changes', 'secure-file-manager' ); ?></button>
     103                        </fieldset>
     104                    </form>
     105                </div>
     106                <div class="col-md-5 offset-md-1">
     107                    <form method="post">
     108                        <fieldset id="sfm_auth_roles">
     109                            <?php
     110                                if( isset( $_POST[ 'sfm_auth_roles' ] ) ) {
     111                                    update_option ( 'sfm_auth_roles', $_POST[ 'sfm_auth_roles' ]);
     112                                }
     113                            ?>
     114                            <h1><?php _e( 'Specify User Role(s)', 'secure-file-manager' ); ?></h1>
     115                            <strong><label><?php _e( 'Which user role(s) should have access to the File Manager?', 'secure-file-manager' ); ?></label></strong>
     116                            <p></p>
     117                            <div class="row">
     118                                <?php foreach ( get_editable_roles() as $role_name => $role_info ): ?>
     119                                    <div class="form-group col-md-6">
     120                                        <input class="form-check-input" type="checkbox" value="<?php echo $role_name; ?>" id="<?php echo $role_name; ?>" name="sfm_auth_roles[]" <?php echo in_array( $role_name, get_option( 'sfm_auth_roles' ) ) ? 'checked' : ''; ?> >
     121                                        <label class="form-check-label" for="<?php echo $role_name; ?>"><span class="checkbox_role"><?php echo $role_info['name']; ?></span></label>
     122                                    </div>
     123                                <?php endforeach; ?>
     124                            </div>
     125                        </fieldset>
     126                        <fieldset>
     127                            <input type="hidden" name="action" value="update" />
     128                            <?php wp_nonce_field( 'sfm_update_action' ); ?>
     129                            <button type="submit" class="btn btn-primary"><?php _e( 'Save Changes', 'secure-file-manager' ); ?></button>
     130                        </fieldset>
     131                    </form>
     132                </div>
     133            </div>
     134            <div>
     135
     136            </div>
    110137        </div>
    111138    </div>
  • secure-file-manager/trunk/readme.txt

    r2037785 r2038744  
    66Tested up to: 5.1
    77Requires PHP: 5.6
    8 Stable tag: 1.3
     8Stable tag: 2.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 Highly Secure and Powerful WordPress File Manage with Multiple Stunning Designs. You can Create, Delete, Edit, Download, Upload, Compress (Zip) files without any FTP software. You can also connect remove FTP location and copy files/folders from there to your server without any trouble.
     12Highly Secure and Powerful WordPress File Manager with Multiple Stunning Designs. You can Create, Delete, Edit, Download, Upload, Compress (Zip) files without any FTP software. You can also connect remove FTP location and copy files/folders from there to your server without any trouble.
    1313
    1414== Description ==
     
    5858YES! Your server files are your property. So is this plugin after you install it.
    5959
     60= Can I allow users with specific Role(s)? =
     61YES! Now you can select the roles who will
     62
    6063= Can I get support for this plugin? =
    6164Definitely! We provide support for anything related to WordPress.
    6265
    6366= Can I change file manager design easily? ==
    64 Yes! Simply go to plugin settings and select the design you want and save. That\'s it!
     67Yes! Simply go to plugin settings and select the design you want and save. That's it!
    6568
    6669= Can I set custom path to start? =
     
    8689* WordPress 5.1 Compatibility.
    8790
     91= 2.0 =
     92* Restrict with User Role Feature Added.
     93
    8894== Upgrade Notice ==
    8995= 1.0 =
  • secure-file-manager/trunk/secure-file-manager.php

    r2037784 r2038744  
    33/**
    44 * @package Secure File Manager
    5  * @version 1.1
     5 * @version 2.0
    66 */
    77
     
    1111Description: Most Beautiful and Secure WordPress File Manager
    1212Author: Themexa
    13 Version: 1.3
     13Version: 2.0
    1414Author URI: https://www.themexa.com
    1515License: GPL2
     
    2525 * Current plugin version.
    2626 */
    27 define( 'secure-file-manager', '1.0' );
     27define( 'secure-file-manager', '2.0' );
    2828
    2929/**
Note: See TracChangeset for help on using the changeset viewer.