Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ switch back to the previous account.

It adds a link on a user\'s profile page that allows permitted users to
masquerade as that user. Upon masquerading, a link to "switch back" to the
original user will appear in the menu. While masquerading, the option to
masquerade as another user will not appear. All masquerading transactions
are logged, and `$user->masquerading` will be set; this could be displayed
via theme.
original user will appear in the menu. While masquerading, the option to
masquerade as another user will not appear. All masquerading transactions
are logged, and a session flag `$_SESSION['masquerading']` will be set,
containing the user ID of the original account (the one that is masquerading as
another account).

In the masquerade settings a list of roles are presented; any checked role
is considered an "administrator" and requires the second level "masquerade as admin"
permission to masquerade as. User #1 is automatically considered an administrator,
regardless of roles.
is considered an "administrator" and requires the second level "masquerade as
admin" permission to masquerade as. User #1 is automatically considered an
administrator, regardless of roles.

Installation
----------------------------

To install the Masquerade module, extract the module to your modules folder.
After enabling the module, it can be configured under
After enabling the module, it can be configured under
Configuration > User accounts > Masquerade. To enable users to
masquerade, assign the appropriate "masquerade module" permissions to the roles
available on your site. For example:
Expand All @@ -39,15 +40,15 @@ available on your site. For example:
in the Masquerade configuration, set 'administrator' as an
administrator role.


Usage / Quick Switch Menu
----------------------------

By default, when a user is selected for the 'Menu Quick Switch user', the Masquerade module adds two menu items to the 'Navigation' menu:

* Masquerade as 'the user selected': When clicked, the user can quick switch to the user selected.
* Switch back: This menu item appears while masquerading so that you can switch back to your original user.

License
----------------------------

Expand Down
36 changes: 9 additions & 27 deletions masquerade.install
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,6 @@
*/
function masquerade_schema() {
return array(
'masquerade' => array(
'description' => 'Each masquerading user has their session recorded into the masquerade table. Each record represents a masquerading user.',
'fields' => array(
'sid' => array(
'description' => 'The current session for this masquerading user corresponding to their {sessions}.sid.',
'type' => 'varchar',
'length' => '64',
'not null' => TRUE,
'default' => ''),
'uid_from' => array(
'description' => 'The {users}.uid corresponding to a session.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'disp-width' => '10'),
'uid_as' => array(
'description' => 'The {users}.uid this session is masquerading as.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'disp-width' => '10'),
),
'indexes' => array(
'sid' => array('sid', 'uid_from'),
'sid_2' => array('sid', 'uid_as'),
),
),
'masquerade_users' => array(
'description' => 'Per-user permission table granting permissions to switch as a specific user.',
'fields' => array(
Expand Down Expand Up @@ -106,6 +79,15 @@ function masquerade_update_1000() {
update_variable_del('masquerade_quick_switches');
}

/**
* Delete masquerade table.
*/
function masquerade_update_1001() {
if (db_table_exists('masquerade')) {
db_drop_table('masquerade');
}
}

/*
* @} End of "defgroup updates-7.x-to-1.x"
* The next series of updates should start at 2000.
Expand Down
Loading