diff --git a/src/bundle/Resources/api_platform/roles_schemas.yml b/src/bundle/Resources/api_platform/roles_schemas.yml new file mode 100644 index 0000000..88672bb --- /dev/null +++ b/src/bundle/Resources/api_platform/roles_schemas.yml @@ -0,0 +1,273 @@ +schemas: + Role: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class represents a role. + type: object + required: + - identifier + - Policies + properties: + identifier: + description: Readable string identifier of a role. + type: string + Policies: + description: Returns the list of policies of this role. + type: + $ref: "#/components/schemas/BaseObject" + RoleWrapper: + type: object + required: + - Role + properties: + Role: + $ref: "#/components/schemas/Role" + RoleDraft: + description: This class represents a draft of a role, extends Role. + type: + $ref: "#/components/schemas/Role" + RoleDraftWrapper: + type: object + required: + - Role + properties: + Role: + $ref: "#/components/schemas/RoleDraft" + RoleInput: + description: This class represents a Role input. + type: object + required: + - identifier + properties: + identifier: + type: string + RoleInputWrapper: + type: object + required: + - RoleInput + properties: + RoleInput: + $ref: "#/components/schemas/RoleInput" + RoleList: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class represents a list roles. + type: object + required: + - Role + properties: + Role: + type: array + items: + $ref: "#/components/schemas/Role" + RoleListWrapper: + type: object + required: + - RoleList + properties: + RoleList: + $ref: "#/components/schemas/RoleList" + Policy: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class represents a policy value. + type: object + required: + - id + - module + - function + properties: + id: + description: ID of the policy. + type: integer + module: + description: Name of module, associated with the Policy e.g. content. + type: string + function: + description: Name of the module function Or all functions with '*' e.g. read. + type: string + limitations: + description: Limitations. + type: object + required: + - limitation + properties: + limitation: + type: array + items: + $ref: "#/components/schemas/Limitation" + PolicyWrapper: + type: object + required: + - Policy + properties: + Policy: + $ref: "#/components/schemas/Policy" + Limitation: + description: This class represents a Limitation applied to a policy. + type: object + required: + - _identifier + - values + properties: + _identifier: + description: "Returns the limitation identifier (one of the defined constants) or a custom limitation. Constants: CONTENTTYPE = Class; LANGUAGE = Language; LOCATION = Node; OWNER = Owner; PARENTOWNER = ParentOwner; PARENTCONTENTTYPE = ParentClass; PARENTDEPTH = ParentDepth; SECTION = Section; NEWSECTION = NewSection; SITEACCESS = SiteAccess; STATE = State; NEWSTATE = NewState; SUBTREE = Subtree; USERGROUP = Group; PARENTUSERGROUP = ParentGroup; STATUS = Status." + enum: + - ContentType + - Language + - Location + - Owner + - Parentowner + - ParentContentType + - ParentDepth + - Section + - NewSection + - SiteAccess + - State + - NewState + - Subtree + - UserGroup + - ParentUserGroup + - Status + - Class + xml: + attribute: true + name: identifier + type: string + values: + description: A read-only list of IDs or identifiers for which the limitation should be applied. The value of this property must conform to a hash, which means that it may only consist of array and scalar values, but must not contain objects or resources. + type: object + required: + - $ref + properties: + ref: + type: array + items: + $ref: "#/components/schemas/Ref" + PolicyList: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: List of policies. + type: object + required: + - Policy + properties: + Policy: + type: array + items: + $ref: "#/components/schemas/Policy" + PolicyListWrapper: + type: object + required: + - PolicyList + properties: + PolicyList: + $ref: "#/components/schemas/PolicyList" + PolicyCreate: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class is used to create a Policy. + type: object + required: + - module + - function + - Limitations + properties: + module: + description: Name of module associated with the Policy. For example, content. + type: string + function: + description: Name of the module function, or all functions with ''*''. For example, read. + type: string + Limitations: + type: array + items: + $ref: "#/components/schemas/Limitation" + PolicyCreateWrapper: + type: object + required: + - PolicyCreate + properties: + PolicyCreate: + $ref: "#/components/schemas/PolicyCreate" + PolicyUpdate: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class is used to update a Policy. + type: object + required: + - Limitations + properties: + Limitations: + type: array + items: + $ref: "#/components/schemas/Limitation" + PolicyUpdateWrapper: + type: object + required: + - PolicyUpdate + properties: + PolicyUpdate: + $ref: "#/components/schemas/PolicyUpdate" + RoleAssignment: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This value object represents an assignment of a User or User group to a role including a limitation. + type: object + required: + - Role + properties: + limitation: + description: Returns the limitation of the role assignment. + Role: + description: Returns the role to which the User or User group is assigned to. + type: + $ref: "#/components/schemas/Ref" + RoleAssignmentWrapper: + type: object + required: + - RoleAssignment + properties: + RoleAssignment: + $ref: "#/components/schemas/RoleAssignment" + RoleAssignInput: + description: This class represents a Role assign input. + type: object + required: + - Role + - limitation + properties: + Role: + description: Returns the Role to which the user or user group is assigned to. + type: + $ref: "#/components/schemas/Ref" + limitation: + description: Returns the Limitation of the Role assignment. + type: + $ref: "#/components/schemas/Limitation" + RoleAssignInputWrapper: + type: object + required: + - RoleAssignInput + properties: + RoleAssignInput: + $ref: "#/components/schemas/RoleAssignInput" + RoleAssignmentList: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This value object represents a list of assignments of a User or User group to a role including a limitation. + type: object + required: + - RoleAssignment + properties: + RoleAssignment: + type: array + items: + $ref: "#/components/schemas/RoleAssignment" + RoleAssignmentListWrapper: + type: object + required: + - RoleAssignmentList + properties: + RoleAssignmentList: + $ref: "#/components/schemas/RoleAssignmentList" diff --git a/src/bundle/Resources/api_platform/sessions_schemas.yml b/src/bundle/Resources/api_platform/sessions_schemas.yml new file mode 100644 index 0000000..045877d --- /dev/null +++ b/src/bundle/Resources/api_platform/sessions_schemas.yml @@ -0,0 +1,52 @@ +schemas: + Session: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: Value for session. + type: object + required: + - name + - identifier + - csrfToken + - User + properties: + name: + description: Name. + type: string + identifier: + description: Identifier. + type: string + csrfToken: + description: csrfToken. + type: string + User: + description: User. + type: + $ref: "#/components/schemas/BaseObject" + SessionWrapper: + type: object + required: + - Session + properties: + Session: + $ref: "#/components/schemas/Session" + SessionInput: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class represents a session input. + type: object + required: + - login + - password + properties: + login: + type: string + password: + type: string + SessionInputWrapper: + type: object + required: + - SessionInput + properties: + SessionInput: + $ref: "#/components/schemas/SessionInput" diff --git a/src/bundle/Resources/api_platform/token_schemas.yml b/src/bundle/Resources/api_platform/token_schemas.yml new file mode 100644 index 0000000..44d9555 --- /dev/null +++ b/src/bundle/Resources/api_platform/token_schemas.yml @@ -0,0 +1,39 @@ +schemas: + JWT: + description: This class represents the JWT authentication token + type: object + required: + - token + properties: + token: + description: JWT authentication token + type: string + JWTWrapper: + type: object + required: + - JWT + properties: + JWT: + $ref: "#/components/schemas/JWT" + JWTInput: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class represents the input for a JWT authentication token + type: object + required: + - username + - password + properties: + username: + description: User name + type: string + password: + description: User password + type: string + JWTInputWrapper: + type: object + required: + - JWTInput + properties: + JWTInput: + $ref: "#/components/schemas/JWTInput" diff --git a/src/bundle/Resources/api_platform/user_groups_schemas.yml b/src/bundle/Resources/api_platform/user_groups_schemas.yml new file mode 100644 index 0000000..7f3d516 --- /dev/null +++ b/src/bundle/Resources/api_platform/user_groups_schemas.yml @@ -0,0 +1,192 @@ +schemas: + UserGroup: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: Content ID matcher class. + type: object + required: + - _remoteId + - _id + - ContentType + - name + - Versions + - Section + - MainLocation + - Locations + - Owner + - lastModificationDate + - mainLanguageCode + - alwaysAvailable + - Version + - ParentUserGroup + - Subgroups + - Users + - Roles + properties: + _remoteId: + description: Remote ID of the content type. + xml: + attribute: true + name: remoteId + type: string + _id: + description: Unique ID of the content type. + xml: + attribute: true + name: id + type: integer + ContentType: + description: Content type. + type: + $ref: "#/components/schemas/Ref" + name: + type: string + Versions: + description: Returns the VersionInfo for this version. + type: + $ref: "#/components/schemas/Ref" + Section: + description: The Section to which the content item is assigned to. + type: + $ref: "#/components/schemas/Ref" + MainLocation: + type: + $ref: "#/components/schemas/Ref" + Locations: + description: Location of the content item. + type: + $ref: "#/components/schemas/Ref" + Owner: + description: The owner of the content item. + type: + $ref: "#/components/schemas/Ref" + lastModificationDate: + description: Content item modification date. + type: string + format: date-time + mainLanguageCode: + description: The main language code of the content item. + type: string + alwaysAvailable: + type: boolean + Version: + $ref: "#/components/schemas/Version" + ParentUserGroup: + type: + $ref: "#/components/schemas/Ref" + Subgroups: + type: + $ref: "#/components/schemas/Ref" + Users: + type: + $ref: "#/components/schemas/Ref" + Roles: + type: + $ref: "#/components/schemas/Ref" + UserGroupWrapper: + type: object + required: + - UserGroup + properties: + UserGroup: + $ref: "#/components/schemas/UserGroup" + UserGroupList: + description: This class represents a User Group list. + type: + $ref: "#/components/schemas/BaseObject" + UserGroupListWrapper: + type: object + required: + - UserGroupList + properties: + UserGroupList: + $ref: "#/components/schemas/UserGroupList" + UserGroupRefList: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: Returns a list of the sub groups. + type: object + required: + - UserGroup + properties: + UserGroup: + description: This class represents a User group. + type: array + items: + $ref: "#/components/schemas/Ref" + UserGroupRefListWrapper: + type: object + required: + - UserGroupRefList + properties: + UserGroupRefList: + $ref: "#/components/schemas/UserGroupRefList" + UserGroupCreate: + description: This class is used to create a User Group. + type: object + required: + - mainLanguageCode + - remoteId + - fields + properties: + mainLanguageCode: + type: string + remoteId: + type: string + fields: + type: + $ref: "#/components/schemas/Fields" + UserGroupCreateWrapper: + type: object + required: + - UserGroupCreate + properties: + UserGroupCreate: + $ref: "#/components/schemas/UserGroupCreate" + UserGroupUpdate: + description: This class is used to update a User group in the Repository. + type: object + required: + - Section + properties: + Section: + type: object + required: + - _href + properties: + _href: + xml: + attribute: true + name: href + type: string + UserGroupUpdateWrapper: + type: object + required: + - UserGroupUpdate + properties: + UserGroupUpdate: + $ref: "#/components/schemas/UserGroupUpdate" + UserGroupUnassign: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class represents a User group. + type: object + required: + - Unassign + properties: + Unassign: + type: + $ref: "#/components/schemas/Unlink" + Unlink: + description: Unlink a content type group from a content type. + type: object + required: + - _href + - _method + properties: + _href: + type: string + _method: + enum: + - DELETE + type: string diff --git a/src/bundle/Resources/api_platform/users_schemas.yml b/src/bundle/Resources/api_platform/users_schemas.yml new file mode 100644 index 0000000..9d9902f --- /dev/null +++ b/src/bundle/Resources/api_platform/users_schemas.yml @@ -0,0 +1,206 @@ +schemas: + User: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class represents a User value. + type: object + required: + - _id + - _remoteId + - ContentType + - name + - Versions + - Section + - MainLocation + - Locations + - Groups + - Owner + - publishDate + - lastModificationDate + - mainLanguageCode + - alwaysAvailable + - Version + - login + - email + - enabled + - UserGroups + - Roles + properties: + _id: + description: Unique ID of the content type. + xml: + attribute: true + name: id + type: integer + _remoteId: + description: Remote ID of the content type. + xml: + attribute: true + name: remoteId + type: string + ContentType: + description: This class represents a content type. + type: + $ref: "#/components/schemas/BaseObject" + name: + description: Name of the domain object in a given language. + type: string + Versions: + description: Returns the VersionInfo for this version. + type: + $ref: "#/components/schemas/BaseObject" + Section: + description: The Section to which the content item is assigned. + type: + $ref: "#/components/schemas/BaseObject" + MainLocation: + description: Main Location of the object. + type: + $ref: "#/components/schemas/BaseObject" + Locations: + description: Locations of the object. + type: + $ref: "#/components/schemas/BaseObject" + Groups: + description: Group User of the content type. + type: + $ref: "#/components/schemas/BaseObject" + Owner: + description: The owner of the content item. + type: + $ref: "#/components/schemas/BaseObject" + publishDate: + description: Content publication date. + type: string + format: date-time + lastModificationDate: + description: Content modification date. + type: string + format: date-time + mainLanguageCode: + description: The main language code of the content item. + type: string + alwaysAvailable: + description: Indicates if the content item is shown in the main language if it's not present in an other requested language. + type: boolean + Version: + description: Returns the VersionInfo for this version. + login: + description: User login. + type: string + email: + description: User email address. + type: string + enabled: + description: Flag to Signal if User is enabled or not. User can not login if false. + type: boolean + UserGroups: + description: User groups. + type: + $ref: "#/components/schemas/BaseObject" + Roles: + description: Roles. + type: + $ref: "#/components/schemas/BaseObject" + UserWrapper: + type: object + required: + - User + properties: + User: + $ref: "#/components/schemas/User" + UserList: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: This class represents a list of users. + type: object + required: + - User + properties: + User: + type: array + items: + $ref: "#/components/schemas/User" + UserListWrapper: + type: object + required: + - UserList + properties: + UserList: + $ref: "#/components/schemas/UserList" + UserRefList: + allOf: + - $ref: "#/components/schemas/BaseObject" + - description: Returns a list of the users. + type: object + required: + - User + properties: + User: + description: This class represents a User. + type: array + items: + $ref: "#/components/schemas/BaseObject" + UserRefListWrapper: + type: object + required: + - UserRefList + properties: + UserRefList: + $ref: "#/components/schemas/UserRefList" + UserUpdate: + description: This class is used to update a User. + type: object + required: + - login + properties: + login: + type: string + email: + type: string + password: + type: string + enabled: + type: boolean + maxLogin: + type: integer + ContentUpdate: + description: The update structure for the profile content. + ContentMetadataUpdate: + description: The update structure for the profile metadata. + UserUpdateWrapper: + type: object + required: + - UserUpdate + properties: + UserUpdate: + $ref: "#/components/schemas/UserUpdate" + UserCreate: + description: This class is used to create a User. + type: object + required: + - mainLanguageCode + - remoteId + - login + - email + - password + properties: + mainLanguageCode: + type: string + remoteId: + type: string + login: + type: string + email: + type: string + password: + type: string + enabled: + type: boolean + UserCreateWrapper: + type: object + required: + - UserCreate + properties: + UserCreate: + $ref: "#/components/schemas/UserCreate" diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index c7a85e4..2aa270a 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -1,4 +1,5 @@ imports: + - { resource: services/api_platform.yaml } - { resource: services/controllers.yaml } - { resource: services/validators.yaml } - { resource: services/user_settings.yaml } diff --git a/src/bundle/Resources/config/services/api_platform.yaml b/src/bundle/Resources/config/services/api_platform.yaml new file mode 100644 index 0000000..e5283c6 --- /dev/null +++ b/src/bundle/Resources/config/services/api_platform.yaml @@ -0,0 +1,15 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + ibexa.api_platform.schemas_provider.user: + class: Ibexa\Rest\ApiPlatform\SchemasProvider + arguments: + $files: + - '@@IbexaUserBundle/Resources/api_platform/roles_schemas.yml' + - '@@IbexaUserBundle/Resources/api_platform/sessions_schemas.yml' + - '@@IbexaUserBundle/Resources/api_platform/token_schemas.yml' + - '@@IbexaUserBundle/Resources/api_platform/user_groups_schemas.yml' + - '@@IbexaUserBundle/Resources/api_platform/users_schemas.yml'