Merge pull request #22 from umlaeute/feature/default_role
default role for authenticated users
This commit is contained in:
commit
458ac8bd48
@ -73,6 +73,12 @@ $amp_allowed_plugin_pages = array(
|
|||||||
```
|
```
|
||||||
Explore the code to see how to set `$amp_role_capabilities` and `$amp_anon_capabilities`. These are set to defaults in the `amp_env_check()` function.
|
Explore the code to see how to set `$amp_role_capabilities` and `$amp_anon_capabilities`. These are set to defaults in the `amp_env_check()` function.
|
||||||
|
|
||||||
|
You can also assign a default role to all logged-in users that have no explicit role:
|
||||||
|
```
|
||||||
|
$amp_default_role = "Editor";
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
#### NOTE:
|
#### NOTE:
|
||||||
This is a fork of nicwaller's [Authmgr](https://github.com/nicwaller/yourls-authmgr-plugin) merged with Ian barber's[Seperate User's](https://github.com/joshp23/Yourls-Separate-Users) plugin. Both code bases underwent heavy rewrites, and have been extensively updated and tightly integrated here, resulting in a lean and highly functional user authorization management environment.
|
This is a fork of nicwaller's [Authmgr](https://github.com/nicwaller/yourls-authmgr-plugin) merged with Ian barber's[Seperate User's](https://github.com/joshp23/Yourls-Separate-Users) plugin. Both code bases underwent heavy rewrites, and have been extensively updated and tightly integrated here, resulting in a lean and highly functional user authorization management environment.
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Plugin Name: Auth Manager Plus
|
Plugin Name: Auth Manager Plus
|
||||||
Plugin URI: https://github.com/joshp23/YOURLS-AuthMgrPlus
|
Plugin URI: https://github.com/joshp23/YOURLS-AuthMgrPlus
|
||||||
Description: Role Based Access Controlls with seperated user data for authenticated users
|
Description: Role Based Access Controlls with seperated user data for authenticated users
|
||||||
Version: 2.1.2
|
Version: 2.2.0
|
||||||
Author: Josh Panter, nicwaller, Ian Barber <ian.barber@gmail.com>
|
Author: Josh Panter, nicwaller, Ian Barber <ian.barber@gmail.com>
|
||||||
Author URI: https://unfettered.net
|
Author URI: https://unfettered.net
|
||||||
*/
|
*/
|
||||||
@ -219,6 +219,7 @@ function amp_have_capability( $capability ) {
|
|||||||
global $amp_anon_capabilities;
|
global $amp_anon_capabilities;
|
||||||
global $amp_role_capabilities;
|
global $amp_role_capabilities;
|
||||||
global $amp_admin_ipranges;
|
global $amp_admin_ipranges;
|
||||||
|
global $amp_default_role;
|
||||||
|
|
||||||
// Make sure the environment has been setup
|
// Make sure the environment has been setup
|
||||||
amp_env_check();
|
amp_env_check();
|
||||||
@ -253,6 +254,12 @@ function amp_have_capability( $capability ) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( !$return ) {
|
||||||
|
if ( isset( $amp_default_role ) && in_array ($amp_default_role, array_keys( $amp_role_capabilities ) ) ) {
|
||||||
|
$default_caps = $amp_role_capabilities [ $amp_default_role ];
|
||||||
|
$return = in_array( $capability, $default_caps );
|
||||||
|
}
|
||||||
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user