Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit 531a17d

Browse files
committed
fix permissions #15
1 parent 33a551c commit 531a17d

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

authMgrPlus/plugin.php

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Auth Manager Plus
44
Plugin URI: https://github.com/joshp23/YOURLS-AuthMgrPlus
55
Description: Role Based Access Controlls with seperated user data for authenticated users
6-
Version: 2.1.1
6+
Version: 2.1.2
77
Author: Josh Panter, nicwaller, Ian Barber <[email protected]>
88
Author URI: https://unfettered.net
99
*/
@@ -528,25 +528,17 @@ function amp_access_keyword( $keyword ) {
528528

529529
// Check user rights to a keyword ( can manage it )
530530
function amp_manage_keyword( $keyword, $capability ) {
531-
// only authenticated users can manaage keywords
532-
if ( !amp_is_valid_user() )
533-
return false;
534-
// Admin?
535-
if ( amp_have_capability( ampCap::ManageUsrsURL ) )
536-
return true;
537-
// Editor?
538-
$owner = amp_keyword_owner($keyword);
539-
if ( $owner === null && amp_have_capability( ampCap::ManageAnonURL ) )
540-
return true;
541-
else
542-
return false;
543-
// Self Edit?
544-
$user = YOURLS_USER !== false ? YOURLS_USER : NULL;
545-
if ( $owner === $user && amp_have_capability( $capability ) )
546-
return true;
547-
else
548-
return false;
549-
return false;
531+
$return = false; // default is to deny access
532+
if ( amp_is_valid_user() ) { // only authenticated users can manaage keywords
533+
$owner = amp_keyword_owner($keyword);
534+
$user = YOURLS_USER !== false ? YOURLS_USER : NULL;
535+
if ( amp_have_capability( ampCap::ManageUsrsURL ) // Admin?
536+
|| ( $owner === NULL && amp_have_capability( ampCap::ManageAnonURL ) ) // Editor?
537+
|| ( $owner === $user && amp_have_capability( $capability ) ) ); // Self Edit?
538+
$return = true;
539+
}
540+
return $return;
541+
550542
}
551543

552544
// Check keyword ownership

0 commit comments

Comments
 (0)