Ejemplo n.º 1
0
$columns['email'] = array('title' => 'Email Address', 'callback' => function ($user) {
    echo htmlspecialchars($user['email']);
});
$columns['role'] = array('title' => 'Role / Permissions', 'callback' => function ($user) use($roles) {
    if ($user['user_id'] == 1) {
        echo _l('Everything');
    } else {
        if (isset($user['roles']) && $user['roles']) {
            foreach ($user['roles'] as $role) {
                echo $roles[$role['security_role_id']]['name'];
            }
        }
    }
});
$columns['can_login'] = array('title' => 'Can Login', 'callback' => function ($user) {
    echo module_security::can_user_login($user['user_id']) ? _l('Yes') : _l('No');
});
$table_manager->set_columns($columns);
$table_manager->row_callback = function ($row_data) {
    // load the full vendor data before displaying each row so we have access to more details
    return module_user::get_user($row_data['user_id']);
};
$table_manager->set_rows($users);
if (class_exists('module_extra', false)) {
    $table_manager->display_extra('user', function ($user) {
        module_extra::print_table_data('user', $user['user_id']);
    });
}
$table_manager->pagination = true;
$table_manager->print_table();
?>
Ejemplo n.º 2
0
                <td>
                    <input type="password" name="password_new2" value="" />
                    <?php 
        _h('Please confirm your new password here a second time.');
        ?>
                </td>
            </tr>
        </table>
        <?php 
        $fieldset_data['elements']['password'] = array('title' => _l('Change Password'), 'fields' => array(ob_get_clean()));
    }
}
if ((module_user::can_i('view', 'Users Passwords', 'Config') && $user_id == module_security::get_loggedin_id() || module_user::can_i('edit', 'Users Passwords', 'Config')) && (int) $user_id > 0 && $user_id != "new") {
    $fieldset_data['elements']['auto'] = array('title' => _l('Auto Login Link'), 'fields' => array('<a href="' . module_security::generate_auto_login_link($user_id) . '">' . _l('right click - copy link') . '</a> ', _hr('If you give this link to a user (or bookmark it for yourself) then it will log in automatically. To re-set an auto-login link simply change your password to something new.')));
}
if (!module_security::can_user_login($user_id)) {
    $fieldset_data['elements']['warninglogin'] = array('warning' => _l('(note: this user does not have login permissions yet - login will not work)'));
}
echo module_form::generate_fieldset($fieldset_data);
// todo - hook in here for a user configuration area
// modules can load configuration variables in here.
// hmm, is this the same as user roles. i guess it is, we'll just use user roles for now.
?>

    <?php 
/*if(module_user::can_i('edit','Fine Tune Permissions','Config')){

                $user_permissions = module_security::get_user_permissions($user_id);
                if($user_id && !$current_role){
                    // do they have any permissions at all?
                    if(!$user_permissions){