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

Issue-691: Add editorplus to roles allowed to upload data #692

Merged
merged 1 commit into from
Jul 8, 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
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,18 @@ private static function validatePermissionToPost($header): stdClass
// get a list of blogs for which this user is allowed to upload data
$blogs = get_blogs_of_user($user->ID);
$blogsToPost = [];
$allowed_roles = ['editor', 'editorplus', 'administrator'];

foreach ($blogs as $blogId => $blogData) {

$userData = get_users(
$user_data = get_users(
[
'blog_id' => $blogId,
'search' => $user->ID
]
);

if (in_array($userData[0]->roles[0], ['editor', 'administrator']))
if (!empty(array_intersect($allowed_roles, $user_data[0]->roles)))
$blogsToPost[] = trim($blogData->path, '/');
}

Expand Down