/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */
export default function access(initialState: {
  currentUser?: Api.CurrentUser | undefined;
  permissions: string[];
}) {
  const { currentUser, permissions } = initialState || {};
  return {
    canAdmin: currentUser && currentUser.roles && currentUser.roles.some((r) => r === 'admin'),
    grantAccess: (accessCode: string) => {
      return true;
    },
  };
}
