References
summary | ||
private |
converts first character of string to lower case |
|
private |
parses a Code into an abstract syntax tree (AST) |
|
private |
prepare roles for code generator convert array to String value replace " by ' |
|
private |
converts first character of string to upper case |
|
public |
|
|
public |
|
|
public |
V CODE_MODES: undefined[] |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
V TEST_MODEL: string |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
V USER_MODEL: string |
|
public |
|
|
public |
|
|
public |
V modulePath: * |
generator
summary | ||
public |
get generated code from template partials |
|
public |
F getContext(inputSchema: Object, User: string, codeType: string): Object gets context for later template compilation reads schema and determines data context for code replacements |
|
private |
get the name of the partial template according to default naming convention defines the name of the partial template in its directory structure prepare name prefix: take just partial name on root template directory on deeper directory structures, prefix directory name to partial name |
|
public |
F getPartials(configPartial: Object): array reads all available partials of a template directory |
generator/authorize
summary | ||
private |
F extractRoles(allRolesArguments: object, inputSchema: object): array extract the roles from the @authorize directive by reading the input schema's abstract syntax tree to get the roles and their authorized modes |
|
private |
F getFieldType(field: object): type get the field's type |
|
private |
F getRoleType(name: string, inputSchema: object): Object decide, if the given role is whether a 'userRole' or a 'docRole' |
|
private |
get userRoles and docRoles |
|
public |
F isAuthorizeDirectiveDefined(inputSchema: object): boolean checks, if there is authorization logic defined true, if there is an @authorize directive in the header in the type's inputSchema if there is an @authorize directive => true if thers is no @authorize directive => false |
|
public |
F isRoleField(roleName: string, fieldDirectives: any): boolean |
generator/schema
summary | ||
public |
F enhanceSchemaForAuthorization(inputSchema: object): object enhances the schema by additional fields, required for authorization |
generator/util
summary | ||
public |
changes a given string on the first character to lower case |
|
public |
changes a given string on the first character to upper case |
|
public |
F generatePerField(type: *, generators: *): object changes a given string on the first character to lower case |
|
public |
F addPaginationArguments(field: *) |
|
public |
F applyCustomDirectives(field: *) |
|
public |
F argumentsToObject(argumentsAst: *): * |
|
public |
F buildArgument(name: *, type: *): {"kind": string, "name": *, "type": *, "defaultValue": *, "directives": *} |
|
public |
F buildField(name: *, args: *, typeName: *): {"kind": string, "name": *, "arguments": *, "type": *} |
|
public |
|
|
public |
F buildTypeDefinition(name: *, fields: *, kind: *): {"kind": *, "name": *, "interfaces": *, "directives": *, "fields": *} |
|
public |
F buildTypeExtension(type: *): {"kind": *, "definition": *} |
|
public |
F buildTypeReference(name: *): {"kind": string, "name": *} |
|
public |
F getBaseType(type: *): * helper methods to work with graphql ASTs |
|
public |
F idArgument(): * |
|
public |
F isScalarField(field: *): * |
|
public |
V SCALAR_TYPE_NAMES: string[] |
lib
summary | ||
public |
Central logger for authorization checks |
|
public |
F checkAuthDoc(doc: object, me: object, userRoles: array, docRoles: array, User: object, logger: function): object Returns an authorized document |
|
public |
F fieldContainsUserId(docRoleField: object, compressedUserId: object): boolean checks, if a field contains a user's id returns true, if a field of type array/object/string contains the userId |
|
public |
Checks, if an user is logged in |
|
public |
similiar to authLog, registers dataloader on successfull authorization and doesn't throw exception in error case |
|
public |
F protectFields(me: object, authorizedUserRoles: array, protectedFields: array, inputObject: object, User: object): object Protects a field based on authorizations |
|
public |
F queryForRoles(me: object, userRoles: array, docRoles: array, User: object, logger: object): object Prepare a query object for mongodb operations with authorization queries creates an authQuery object with additional query arguments, to implement authorization restrictions for mongodb access |
|
public |
F userRoleAuthorized(me: object, userRoles: array, User: object, logger: object): boolean Is a user's role authorized for a document You can use also the role 'world', to authorize everyone |
|
public |
V dummyUserContext: object: {"authRole": function} Returns a dummyUserContext mocking User authRole, as it is not existing in this library for usage in the test cases, where we don't have an original User model context |