'use strict';
import { getRolesAsync, addToRole } from './user-manager.js';
import { roleNames } from '../../common/auth/roles/role-names.js';
import { publishMessage } from '../../meta/server/messaging/messages.js';

var __defProp=Object['defineProperty'],__name=(_0x254278,_0x4a5069)=>__defProp(_0x254278,'name',{'value':_0x4a5069,'configurable':!![]});async function addUserToRoles(_0x5f5cca,_0x1eb8d1){const _0x1ebaf8=await getRolesAsync(_0x1eb8d1)??[];for(const _0x2b78f0 of _0x5f5cca){if(!_0x1ebaf8['includes'](_0x2b78f0)){await addToRole(_0x1eb8d1,_0x2b78f0);const _0x11ea11={'roleNames':_0x5f5cca,'userId':_0x1eb8d1};await publishMessage(_0x11ea11);}}}__name(addUserToRoles,'addUserToRoles');async function isUserInRole(_0x468b01,_0xd854f8=roleNames['admin']){const _0x3fe02a=await getRolesAsync(_0x468b01)??[];return _0x3fe02a['includes'](_0xd854f8);}__name(isUserInRole,'isUserInRole');

export { addUserToRoles, isUserInRole };
