mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-18 09:52:27 +00:00
feat: supports permission mode for static user provider (#7017)
* feat: supports permission mode for static user provider Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * chore: style Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use auth::UserProviderRef;
|
||||
use auth::{DefaultPermissionChecker, PermissionCheckerRef, UserProviderRef};
|
||||
use common_base::Plugins;
|
||||
use frontend::error::{IllegalAuthConfigSnafu, Result};
|
||||
use frontend::frontend::FrontendOptions;
|
||||
@@ -29,6 +29,9 @@ pub async fn setup_frontend_plugins(
|
||||
if let Some(user_provider) = fe_opts.user_provider.as_ref() {
|
||||
let provider =
|
||||
auth::user_provider_from_option(user_provider).context(IllegalAuthConfigSnafu)?;
|
||||
let permission_checker = DefaultPermissionChecker::arc();
|
||||
|
||||
plugins.insert::<PermissionCheckerRef>(permission_checker);
|
||||
plugins.insert::<UserProviderRef>(provider);
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user