import { BaseService, ValidatedResponse } from '@txstate-mws/graphql-server'; import { DosGatoService, type Role, type RoleFilter, RoleResponse, type RoleInput, RoleAccessLevel, SiteTeamMemberResponse, type Site, type User } from '../internal.js'; export declare class RoleServiceInternal extends BaseService { find(filter?: RoleFilter): Promise; findById(id: string): Promise; findByIds(ids: string[], filter?: RoleFilter): Promise; findByGroupId(groupId: string, direct?: boolean): Promise; findByUserId(userId: string, direct?: boolean): Promise; findByManagerId(managerId: string): Promise; findBySiteId(siteId: string): Promise; } export declare class RoleService extends DosGatoService { raw: RoleServiceInternal; find(filter?: RoleFilter): Promise; findById(id: string): Promise; findByIds(ids: string[], filter?: RoleFilter): Promise; findByGroupId(groupId: string, direct?: boolean): Promise; findByUserId(userId: string, direct?: boolean): Promise; findByManagerId(managerId: string): Promise; findBySiteId(siteId: string): Promise; create(input: RoleInput, validateOnly?: boolean): Promise; update(id: string, input: RoleInput, validateOnly?: boolean): Promise; delete(id: string): Promise; addRolesToUser(roleIds: string[], userId: string): Promise; /** * Figure out which of a site's roles carry the requested access level. Editors and read-only * users get every role at that level (there should be only one of each), while contributors pick the specific roles they need, * so those have to be named and have to belong to this site at that access level. */ protected resolveTargetRoles(siteId: string, access: RoleAccessLevel, roleIds: string[] | undefined, response: SiteTeamMemberResponse): Promise; /** * Gather everything the edit and remove mutations need to know about a user's standing on a * site: the roles they hold on it directly, the ones they only have through a group, and * whether they manage or own it. A user with none of the above is not on the team at all, * which both mutations treat as an error, so that message is added here and reported back as * `isTeamMember: false`. */ protected loadTeamStanding(site: Site, user: User, response: ValidatedResponse): Promise<{ trainings: import("../internal.js").Training[]; currentSiteRoles: Role[]; groupSiteRoles: Role[]; isManager: boolean; isOwner: boolean; isTeamMember: boolean; }>; /** * Add a user to a site's team by giving them the site role(s) that carry the requested * access level. Site owners and managers may do this for their own sites without the * global manageAccess permission, so all the validation a manager needs (does this login * exist, do they have training, does this site have a role at that access level) happens * here and comes back as messages instead of requiring them to look users up directly. */ addSiteTeamMember(siteId: string, userId: string, access: RoleAccessLevel, roleIds?: string[], validateOnly?: boolean): Promise; editSiteTeamMember(siteId: string, userId: string, access: RoleAccessLevel, roleIds?: string[], validateOnly?: boolean): Promise; /** * Remove a user from a site's team: revoke the site roles they hold directly and, if they are * one of the site's managers, revoke that too. Site owners and managers may do this for their * own sites without the global manageAccess permission. * * Only an administrator can change site ownership. */ removeSiteTeamMember(siteId: string, userId: string, validateOnly?: boolean): Promise; assignRoleToUsers(roleId: string, userIds: string[]): Promise; removeRoleFromUser(roleId: string, userId: string): Promise; addRoleToGroups(groupIds: string[], roleId: string): Promise; removeRoleFromGroup(groupId: string, roleId: string): Promise; getRoleForRule(roleId: string): Promise; mayView(role: Role): boolean; mayViewManagerUI(): boolean; mayCreate(): boolean; mayUpdate(role: Role): boolean; mayDelete(role: Role): boolean; mayManageTeam(site: { id: string; }): boolean; mayAssign(role: Role): Promise; mayCreateRules(role: Role): boolean; }