X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fuser%2Fsrc%2FPlugin%2FAction%2FRemoveRoleUser.php;fp=web%2Fcore%2Fmodules%2Fuser%2Fsrc%2FPlugin%2FAction%2FRemoveRoleUser.php;h=66cf6d0f3637b4db2a3b291a510a65224f2c8028;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/user/src/Plugin/Action/RemoveRoleUser.php b/web/core/modules/user/src/Plugin/Action/RemoveRoleUser.php new file mode 100644 index 000000000..66cf6d0f3 --- /dev/null +++ b/web/core/modules/user/src/Plugin/Action/RemoveRoleUser.php @@ -0,0 +1,31 @@ +configuration['rid']; + // Skip removing the role from the user if they already don't have it. + if ($account !== FALSE && $account->hasRole($rid)) { + // For efficiency manually save the original account before applying + // any changes. + $account->original = clone $account; + $account->removeRole($rid); + $account->save(); + } + } + +}