import api from "./api.js";
export default async function name(cb) {
  const permissionsData = await api.get["permissions"]();
  const obj = {
    permissionsData,
    hasPermission(name) {
      return permissionsData.findIndex(el => el.permissions == name) != -1;
    },
    hasGroup(name) {
      return permissionsData.findIndex(el => el.groups == name) != -1;
    }
  };
  cb(obj);
}
