Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20240102-0817 #62

Merged
merged 12 commits into from
Jan 2, 2024
Merged
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
30 changes: 25 additions & 5 deletions user/plugins/auth-mgr-plus/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

class ampRoles {
const Administrator = 'Administrator';
const Supereditor = 'Supereditor';
const Editor = 'Editor';
const Contributor = 'Contributor';
}
Expand Down Expand Up @@ -276,8 +277,8 @@ function amp_have_capability( $capability ) {
if (amp_user_has_role($user, $rolename))
$user_caps = array_merge($user_caps, $rolecaps);
}
elseif ( isset( $amp_default_role ) && in_array ($amp_default_role, array_keys( $amp_role_capabilities ) ) )
$user_caps = $amp_role_capabilities [ $amp_default_role ];
elseif ( isset( $amp_default_role ) && in_array ($amp_default_role, array_keys( $amp_role_capabilities ) ) )
$user_caps = $amp_role_capabilities [ $amp_default_role ];

$user_caps = array_unique( $user_caps );
// Is the requested capability in this list?
Expand Down Expand Up @@ -427,7 +428,14 @@ function amp_env_check() {
global $amp_allowed_plugin_pages;

if ( !isset( $amp_anon_capabilities) ) {
$amp_anon_capabilities = array();
$amp_anon_capabilities = array(
ampCap::ShowAdmin,
ampCap::AddURL,
ampCap::EditURL,
ampCap::DeleteURL,
ampCap::ShareURL,
ampCap::ViewStats,
);
}

if ( !isset( $amp_role_capabilities) ) {
Expand All @@ -447,6 +455,19 @@ function amp_env_check() {
ampCap::ViewStats,
ampCap::ViewAll,
),
ampRoles::Supereditor => array(
ampCap::ShowAdmin,
ampCap::AddURL,
ampCap::EditURL,
ampCap::DeleteURL,
ampCap::ShareURL,
ampCap::Traceless,
ampCap::ManageAnonURL,
ampCap::ManageUsrsURL,
ampCap::APIu,
ampCap::ViewStats,
ampCap::ViewAll,
),
ampRoles::Editor => array(
ampCap::ShowAdmin,
ampCap::AddURL,
Expand Down Expand Up @@ -482,8 +503,7 @@ function amp_env_check() {
}

if ( !isset( $amp_allowed_plugin_pages ) ) {
$amp_allowed_plugin_pages = array(
);
$amp_allowed_plugin_pages = array();
}

// convert role assignment table to lower case if it hasn't been done already
Expand Down