File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 * needIdentificationDocuments: bool,
2929 * identificationDocumentsWaitingApproval: bool,
3030 * }
31+ * @psalm-type LibresignAccountCapabilitySettings = array{
32+ * canRequestSign: bool,
33+ * hasSignatureFile: bool,
34+ * isApprover: bool,
35+ * }
3136 *
3237 * Request input contracts
3338 *
Original file line number Diff line number Diff line change 1515use OCP \Accounts \IAccountManager ;
1616use OCP \IUser ;
1717
18+ /** @psalm-import-type LibresignAccountCapabilitySettings from \OCA\Libresign\ResponseDefinitions */
1819class AccountSettingsProvider {
1920 public function __construct (
2021 private IAccountManager $ accountManager ,
@@ -23,12 +24,15 @@ public function __construct(
2324 ) {
2425 }
2526
27+ /** @psalm-return LibresignAccountCapabilitySettings */
2628 public function getSettings (?IUser $ user = null ): array {
2729 $ canApproveIdDocs = $ this ->idDocsPolicyService ->userCanApproveValidationDocuments ($ user , false );
28- $ return ['canRequestSign ' ] = $ canApproveIdDocs ;
29- $ return ['hasSignatureFile ' ] = $ this ->hasSignatureFile ($ user );
30- $ return ['isApprover ' ] = $ canApproveIdDocs ;
31- return $ return ;
30+
31+ return [
32+ 'canRequestSign ' => $ canApproveIdDocs ,
33+ 'hasSignatureFile ' => $ this ->hasSignatureFile ($ user ),
34+ 'isApprover ' => $ canApproveIdDocs ,
35+ ];
3236 }
3337
3438 public function getPhoneNumber (IUser $ user ): string {
Original file line number Diff line number Diff line change 1717use OCA \Libresign \Service \IdentifyMethodService ;
1818use OCP \IUser ;
1919
20+ /** @psalm-import-type LibresignSettings from \OCA\Libresign\ResponseDefinitions */
2021class SettingsLoader {
2122 public const IDENTIFICATION_DOCUMENTS_DISABLED = 0 ;
2223 public const IDENTIFICATION_DOCUMENTS_NEED_SEND = 1 ;
@@ -125,7 +126,7 @@ private function calculateStatusFromFiles(?array $files): int {
125126 * Always returns complete settings payload with defaults.
126127 * Canonical API shape is documented as LibresignSettings in ResponseDefinitions.
127128 *
128- * @return array<string, bool|string>
129+ * @psalm- return LibresignSettings
129130 */
130131 public function getUserIdentificationSettings (?IUser $ user , ?SignRequest $ signRequest = null ): array {
131132 $ status = $ this ->getIdentificationDocumentsStatus ($ user , $ signRequest );
Original file line number Diff line number Diff line change 2020 }
2121 },
2222 "schemas": {
23+ "AccountCapabilitySettings": {
24+ "type": "object",
25+ "required": [
26+ "canRequestSign",
27+ "hasSignatureFile",
28+ "isApprover"
29+ ],
30+ "properties": {
31+ "canRequestSign": {
32+ "type": "boolean"
33+ },
34+ "hasSignatureFile": {
35+ "type": "boolean"
36+ },
37+ "isApprover": {
38+ "type": "boolean"
39+ }
40+ }
41+ },
2342 "AccountMeResponse": {
2443 "type": "object",
2544 "required": [
Original file line number Diff line number Diff line change @@ -1610,6 +1610,11 @@ export type paths = {
16101610export type webhooks = Record < string , never > ;
16111611export type components = {
16121612 schemas : {
1613+ AccountCapabilitySettings : {
1614+ canRequestSign : boolean ;
1615+ hasSignatureFile : boolean ;
1616+ isApprover : boolean ;
1617+ } ;
16131618 AccountMeResponse : {
16141619 account : {
16151620 uid : string ;
You can’t perform that action at this time.
0 commit comments