@komune-io/im-user-domain 0.21.0-alpha.2e8dcba → 0.21.0-alpha.2fffa5b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -633,6 +633,16 @@ export declare namespace io.komune.im.f2.user.domain.command {
633
633
 
634
634
  }
635
635
  }
636
+ export declare namespace io.komune.im.f2.user.domain.command {
637
+ interface UserDisableMfaCommandDTO extends f2.dsl.cqrs.Command {
638
+ readonly id: string;
639
+
640
+ }
641
+ interface UserDisabledMfaEventDTO extends f2.dsl.cqrs.Event {
642
+ readonly id: string;
643
+
644
+ }
645
+ }
636
646
  export declare namespace io.komune.im.f2.user.domain.command {
637
647
  interface UserResetPasswordCommandDTO extends f2.dsl.cqrs.Command {
638
648
  readonly id: string;
@@ -693,6 +703,7 @@ export declare namespace io.komune.im.f2.user.domain.model {
693
703
  readonly address?: io.komune.im.commons.model.AddressDTO;
694
704
  readonly phone?: string;
695
705
  readonly roles: io.komune.im.f2.privilege.domain.role.model.RoleDTO[];
706
+ readonly mfa?: string[];
696
707
  readonly attributes: Record<string, string>;
697
708
  readonly enabled: boolean;
698
709
  readonly disabledBy?: string;
@@ -708,6 +719,8 @@ export declare namespace io.komune.im.f2.user.domain.policies {
708
719
  checkRefList(authedUser: io.komune.im.commons.auth.AuthedUserDTO): boolean;
709
720
  canCreate(authedUser: io.komune.im.commons.auth.AuthedUserDTO, organizationId?: string): boolean;
710
721
  canUpdate(authedUser: io.komune.im.commons.auth.AuthedUserDTO, user: io.komune.im.f2.user.domain.model.UserDTO): boolean;
722
+ canConfigureMfa(authedUser: io.komune.im.commons.auth.AuthedUserDTO, user: io.komune.im.f2.user.domain.model.UserDTO): boolean;
723
+ canDisableMfa(authedUser: io.komune.im.commons.auth.AuthedUserDTO, user: io.komune.im.f2.user.domain.model.UserDTO): boolean;
711
724
  canUpdateMemberOf(authedUser: io.komune.im.commons.auth.AuthedUserDTO): boolean;
712
725
  canUpdateRole(authedUser: io.komune.im.commons.auth.AuthedUserDTO): boolean;
713
726
  canDisable(authedUser: io.komune.im.commons.auth.AuthedUserDTO, user: io.komune.im.f2.user.domain.model.UserDTO): boolean;
@@ -536,6 +536,8 @@ if (typeof Math.imul === 'undefined') {
536
536
  setMetadataFor(UserDeletedEventDTO_0, 'UserDeletedEventDTO', interfaceMeta, VOID, [UserDeletedEventDTO, Event]);
537
537
  setMetadataFor(UserDisableCommandDTO, 'UserDisableCommandDTO', interfaceMeta, VOID, [Command]);
538
538
  setMetadataFor(UserDisabledEventDTO, 'UserDisabledEventDTO', interfaceMeta, VOID, [Event]);
539
+ setMetadataFor(UserDisableMfaCommandDTO, 'UserDisableMfaCommandDTO', interfaceMeta, VOID, [Command]);
540
+ setMetadataFor(UserDisabledMfaEventDTO, 'UserDisabledMfaventDTO', interfaceMeta, VOID, [Event]);
539
541
  setMetadataFor(UserResetPasswordCommandDTO, 'UserResetPasswordCommandDTO', interfaceMeta, VOID, [Command]);
540
542
  setMetadataFor(UserResetPasswordEventDTO, 'UserResetPasswordEventDTO', interfaceMeta, VOID, [Event]);
541
543
  setMetadataFor(UserUpdateCommandDTO, 'UserUpdateCommandDTO', interfaceMeta, VOID, [Command]);
@@ -12315,6 +12317,10 @@ if (typeof Math.imul === 'undefined') {
12315
12317
  }
12316
12318
  function UserDisabledEventDTO() {
12317
12319
  }
12320
+ function UserDisableMfaCommandDTO() {
12321
+ }
12322
+ function UserDisabledMfaEventDTO() {
12323
+ }
12318
12324
  function UserResetPasswordCommandDTO() {
12319
12325
  }
12320
12326
  function UserResetPasswordEventDTO() {
@@ -12351,7 +12357,10 @@ if (typeof Math.imul === 'undefined') {
12351
12357
  return tmp;
12352
12358
  }
12353
12359
  function isNotMySelf($this, authedUser, user) {
12354
- return !(authedUser.id === user.id);
12360
+ return !isMySelf($this, authedUser, user);
12361
+ }
12362
+ function isMySelf($this, authedUser, user) {
12363
+ return authedUser.id === user.id;
12355
12364
  }
12356
12365
  function UserPolicies() {
12357
12366
  }
@@ -12384,6 +12393,12 @@ if (typeof Math.imul === 'undefined') {
12384
12393
  protoOf(UserPolicies).canUpdate = function (authedUser, user) {
12385
12394
  return canWriteUser(this, authedUser, user);
12386
12395
  };
12396
+ protoOf(UserPolicies).canConfigureMfa = function (authedUser, user) {
12397
+ return isMySelf(this, authedUser, user);
12398
+ };
12399
+ protoOf(UserPolicies).canDisableMfa = function (authedUser, user) {
12400
+ return isMySelf(this, authedUser, user);
12401
+ };
12387
12402
  protoOf(UserPolicies).canUpdateMemberOf = function (authedUser) {
12388
12403
  return hasRole(authedUser, ImRole_IM_ORGANIZATION_WRITE_getInstance());
12389
12404
  };
@@ -12982,6 +12997,13 @@ if (typeof Math.imul === 'undefined') {
12982
12997
  var $io$komune$im$f2 = $io$komune$im.f2 || ($io$komune$im.f2 = {});
12983
12998
  var $io$komune$im$f2$user = $io$komune$im$f2.user || ($io$komune$im$f2.user = {});
12984
12999
  var $io$komune$im$f2$user$domain = $io$komune$im$f2$user.domain || ($io$komune$im$f2$user.domain = {});
13000
+ var $io$komune$im$f2$user$domain$command = $io$komune$im$f2$user$domain.command || ($io$komune$im$f2$user$domain.command = {});
13001
+ var $io = _.io || (_.io = {});
13002
+ var $io$komune = $io.komune || ($io.komune = {});
13003
+ var $io$komune$im = $io$komune.im || ($io$komune.im = {});
13004
+ var $io$komune$im$f2 = $io$komune$im.f2 || ($io$komune$im.f2 = {});
13005
+ var $io$komune$im$f2$user = $io$komune$im$f2.user || ($io$komune$im$f2.user = {});
13006
+ var $io$komune$im$f2$user$domain = $io$komune$im$f2$user.domain || ($io$komune$im$f2$user.domain = {});
12985
13007
  var $io$komune$im$f2$user$domain$model = $io$komune$im$f2$user$domain.model || ($io$komune$im$f2$user$domain.model = {});
12986
13008
  var $io = _.io || (_.io = {});
12987
13009
  var $io$komune = $io.komune || ($io.komune = {});