diff --git a/apps/wallet/public/.well-known/ic-domains b/apps/wallet/public/.well-known/ic-domains index f5f9568fa..653eaa120 100644 --- a/apps/wallet/public/.well-known/ic-domains +++ b/apps/wallet/public/.well-known/ic-domains @@ -1,4 +1,5 @@ orbitwallet.io +alpha.orbitwallet.io staging.orbitwallet.io testing.orbitwallet.io dev.orbitwallet.io diff --git a/apps/wallet/src/components/accounts/wizard/AccountConfigurationSettings.vue b/apps/wallet/src/components/accounts/wizard/AccountConfigurationSettings.vue index 5d8dd5502..77c1e95e1 100644 --- a/apps/wallet/src/components/accounts/wizard/AccountConfigurationSettings.vue +++ b/apps/wallet/src/components/accounts/wizard/AccountConfigurationSettings.vue @@ -9,7 +9,7 @@ variant="plain" density="comfortable" hide-details - :disabled="isViewMode" + disabled /> @@ -22,7 +22,7 @@ :rules="[requiredRule]" variant="filled" density="comfortable" - :disabled="isViewMode" + :disabled="isViewMode || !!model.id" @selected-asset="onSelectedAsset" /> diff --git a/apps/wallet/src/components/request-policies/rule/QuorumPercentageRule.vue b/apps/wallet/src/components/request-policies/rule/QuorumPercentageRule.vue index 345e87ec7..88cd5e187 100644 --- a/apps/wallet/src/components/request-policies/rule/QuorumPercentageRule.vue +++ b/apps/wallet/src/components/request-policies/rule/QuorumPercentageRule.vue @@ -67,7 +67,6 @@ import { mapRequestPolicyRuleUserSpecifierEnumToVariant, mapRequestPolicyRuleUserSpecifierToEnum, } from '~/mappers/request-specifiers.mapper'; -import { RequestPolicyRuleUserSpecifierEnum } from '~/types/station.types'; import { variantIs } from '~/utils/helper.utils'; const input = withDefaults( @@ -104,16 +103,8 @@ const disabledSlider = ref(false); watch( () => userTypeModel.value, - userType => { - switch (userType) { - case RequestPolicyRuleUserSpecifierEnum.Requester: - model.value.min_approved = 100; - disabledSlider.value = true; - break; - default: - disabledSlider.value = false; - break; - } + _ => { + disabledSlider.value = false; }, { immediate: true }, ); diff --git a/apps/wallet/src/components/request-policies/rule/QuorumRule.vue b/apps/wallet/src/components/request-policies/rule/QuorumRule.vue index a84175cfd..f4d007e14 100644 --- a/apps/wallet/src/components/request-policies/rule/QuorumRule.vue +++ b/apps/wallet/src/components/request-policies/rule/QuorumRule.vue @@ -69,7 +69,6 @@ import { mapRequestPolicyRuleUserSpecifierToEnum, } from '~/mappers/request-specifiers.mapper'; import { FormValidationRules } from '~/types/helper.types'; -import { RequestPolicyRuleUserSpecifierEnum } from '~/types/station.types'; import { intNumberRangeRule, requiredRule } from '~/utils/form.utils'; import { variantIs } from '~/utils/helper.utils'; @@ -130,16 +129,8 @@ const disabledInput = ref(false); watch( () => userTypeModel.value, - userType => { - switch (userType) { - case RequestPolicyRuleUserSpecifierEnum.Requester: - model.value.min_approved = 1; - disabledInput.value = true; - break; - default: - disabledInput.value = false; - break; - } + _ => { + disabledInput.value = false; }, { immediate: true }, ); diff --git a/apps/wallet/src/generated/station/station.did b/apps/wallet/src/generated/station/station.did index 9bb39d51b..8f1323ced 100644 --- a/apps/wallet/src/generated/station/station.did +++ b/apps/wallet/src/generated/station/station.did @@ -140,8 +140,6 @@ type UserSpecifier = variant { Any; Id : vec UUID; Group : vec UUID; - Owner; - Requester; }; type ResourceSpecifier = variant { diff --git a/apps/wallet/src/generated/station/station.did.d.ts b/apps/wallet/src/generated/station/station.did.d.ts index d495b8f03..b9bab7eef 100644 --- a/apps/wallet/src/generated/station/station.did.d.ts +++ b/apps/wallet/src/generated/station/station.did.d.ts @@ -818,9 +818,7 @@ export type UserResourceAction = { 'List' : null } | { 'Update' : ResourceId }; export type UserSpecifier = { 'Id' : Array } | { 'Any' : null } | - { 'Group' : Array } | - { 'Requester' : null } | - { 'Owner' : null }; + { 'Group' : Array }; export type UserStatus = { 'Inactive' : null } | { 'Active' : null }; export interface _SERVICE { diff --git a/apps/wallet/src/generated/station/station.did.js b/apps/wallet/src/generated/station/station.did.js index d74c9b700..09907c3c5 100644 --- a/apps/wallet/src/generated/station/station.did.js +++ b/apps/wallet/src/generated/station/station.did.js @@ -119,8 +119,6 @@ export const idlFactory = ({ IDL }) => { 'Id' : IDL.Vec(UUID), 'Any' : IDL.Null, 'Group' : IDL.Vec(UUID), - 'Requester' : IDL.Null, - 'Owner' : IDL.Null, }); const Quorum = IDL.Record({ 'min_approved' : IDL.Nat16, diff --git a/apps/wallet/src/mappers/request-specifiers.mapper.ts b/apps/wallet/src/mappers/request-specifiers.mapper.ts index bf325d19a..ca7ca46cf 100644 --- a/apps/wallet/src/mappers/request-specifiers.mapper.ts +++ b/apps/wallet/src/mappers/request-specifiers.mapper.ts @@ -73,14 +73,6 @@ export const mapRequestSpecifierToEnum = (specifier: RequestSpecifier): RequestS export const mapRequestPolicyRuleUserSpecifierToEnum = ( specifier: UserSpecifier, ): RequestPolicyRuleUserSpecifierEnum => { - if (variantIs(specifier, 'Owner')) { - return RequestPolicyRuleUserSpecifierEnum.Owner; - } - - if (variantIs(specifier, 'Requester')) { - return RequestPolicyRuleUserSpecifierEnum.Requester; - } - if (variantIs(specifier, 'Any')) { return RequestPolicyRuleUserSpecifierEnum.Any; } @@ -100,10 +92,6 @@ export const mapRequestPolicyRuleUserSpecifierEnumToVariant = ( specifier: RequestPolicyRuleUserSpecifierEnum, ): UserSpecifier => { switch (specifier) { - case RequestPolicyRuleUserSpecifierEnum.Owner: - return { Owner: null }; - case RequestPolicyRuleUserSpecifierEnum.Requester: - return { Requester: null }; case RequestPolicyRuleUserSpecifierEnum.Any: return { Any: null }; case RequestPolicyRuleUserSpecifierEnum.Group: diff --git a/apps/wallet/src/stores/station.store.ts b/apps/wallet/src/stores/station.store.ts index 48db704ac..2809bc492 100644 --- a/apps/wallet/src/stores/station.store.ts +++ b/apps/wallet/src/stores/station.store.ts @@ -79,8 +79,8 @@ export const createUserInitialAccount = async ( user_groups: [], users: [userId], }, - configs_request_policy: [{ Quorum: { min_approved: 100, approvers: { Owner: null } } }], - transfer_request_policy: [{ Quorum: { min_approved: 100, approvers: { Owner: null } } }], + configs_request_policy: [{ Quorum: { min_approved: 1, approvers: { Id: [userId] } } }], + transfer_request_policy: [{ Quorum: { min_approved: 1, approvers: { Id: [userId] } } }], }, }, }); diff --git a/apps/wallet/src/types/station.types.ts b/apps/wallet/src/types/station.types.ts index b286212d9..a1c187f26 100644 --- a/apps/wallet/src/types/station.types.ts +++ b/apps/wallet/src/types/station.types.ts @@ -114,8 +114,6 @@ export enum RequestPolicyRuleEnum { } export enum RequestPolicyRuleUserSpecifierEnum { - Owner = 'Owner', - Requester = 'Requester', Any = 'Any', Group = 'Group', Id = 'Id', diff --git a/canister_ids.json b/canister_ids.json index 949c38006..f496e3e8f 100644 --- a/canister_ids.json +++ b/canister_ids.json @@ -1,10 +1,12 @@ { + "app_wallet": { + "playground": "bxkhk-6yaaa-aaaal-ai6va-cai", + "production": "5fu67-giaaa-aaaal-ajbla-cai", + "testing": "l3uq6-ryaaa-aaaal-adu2a-cai" + }, "control_panel": { "playground": "b6jmw-iqaaa-aaaal-ai6uq-cai", + "production": "5mxvd-qaaaa-aaaal-ajbkq-cai", "testing": "lotbt-qqaaa-aaaal-aduzq-cai" - }, - "ui": { - "playground": "bxkhk-6yaaa-aaaal-ai6va-cai", - "testing": "l3uq6-ryaaa-aaaal-adu2a-cai" } } \ No newline at end of file diff --git a/core/station/api/spec.did b/core/station/api/spec.did index 9bb39d51b..8f1323ced 100644 --- a/core/station/api/spec.did +++ b/core/station/api/spec.did @@ -140,8 +140,6 @@ type UserSpecifier = variant { Any; Id : vec UUID; Group : vec UUID; - Owner; - Requester; }; type ResourceSpecifier = variant { diff --git a/core/station/api/src/request_policy.rs b/core/station/api/src/request_policy.rs index 189922962..b43934649 100644 --- a/core/station/api/src/request_policy.rs +++ b/core/station/api/src/request_policy.rs @@ -26,8 +26,6 @@ pub enum UserSpecifierDTO { Any, Group(Vec), Id(Vec), - Owner, - Requester, } #[derive(CandidType, Deserialize, Debug, Clone)] diff --git a/core/station/impl/src/core/request.rs b/core/station/impl/src/core/request.rs index 283e07c52..ab38e426b 100644 --- a/core/station/impl/src/core/request.rs +++ b/core/station/impl/src/core/request.rs @@ -9,8 +9,7 @@ use crate::{ request_specifier::{ Match, RequestSpecifier, UserInvolvedInPolicyRuleForRequestResource, UserSpecifier, }, - EvaluationStatus, Request, RequestId, RequestOperation, RequestStatusCode, User, UserId, - UserStatus, + EvaluationStatus, Request, RequestId, RequestStatusCode, User, UserId, UserStatus, }, repositories::{ request_policy::REQUEST_POLICY_REPOSITORY, REQUEST_REPOSITORY, USER_REPOSITORY, @@ -237,39 +236,6 @@ impl UserSpecifier::Group(group_ids) => { possible_approvers.groups.extend(group_ids.to_owned()); - Ok(possible_approvers) - } - UserSpecifier::Requester => { - possible_approvers - .users - .insert(request.requested_by.to_owned()); - - Ok(possible_approvers) - } - UserSpecifier::Owner => { - match &request.operation { - RequestOperation::EditUser(operation) => { - possible_approvers - .users - .insert(operation.input.user_id.to_owned()); - } - RequestOperation::EditAccount(_) - | RequestOperation::Transfer(_) - | RequestOperation::AddAccount(_) - | RequestOperation::AddAddressBookEntry(_) - | RequestOperation::AddRequestPolicy(_) - | RequestOperation::AddUser(_) - | RequestOperation::AddUserGroup(_) - | RequestOperation::EditAddressBookEntry(_) - | RequestOperation::RemoveAddressBookEntry(_) - | RequestOperation::EditPermission(_) - | RequestOperation::EditRequestPolicy(_) - | RequestOperation::EditUserGroup(_) - | RequestOperation::RemoveRequestPolicy(_) - | RequestOperation::RemoveUserGroup(_) - | RequestOperation::ChangeCanister(_) => {} - }; - Ok(possible_approvers) } }, @@ -460,7 +426,7 @@ mod tests { user_test_utils::{self, mock_user}, Account, AccountKey, AddUserGroupOperation, AddUserGroupOperationInput, Blockchain, BlockchainStandard, EvaluatedRequestPolicyRule, Metadata, MetadataItem, Percentage, - RequestPolicy, RequestStatus, ADMIN_GROUP_ID, + RequestOperation, RequestPolicy, RequestStatus, ADMIN_GROUP_ID, }, repositories::{ request_policy::REQUEST_POLICY_REPOSITORY, ACCOUNT_REPOSITORY, @@ -508,8 +474,7 @@ mod tests { REQUEST_REPOSITORY.insert(request.to_key(), request.clone()); policy.specifier = RequestSpecifier::AddUserGroup; - policy.rule = - RequestPolicyRule::QuorumPercentage(UserSpecifier::Requester, Percentage(100)); + policy.rule = RequestPolicyRule::QuorumPercentage(UserSpecifier::Any, Percentage(100)); REQUEST_POLICY_REPOSITORY.insert(policy.id, policy.clone()); diff --git a/core/station/impl/src/mappers/request_policy.rs b/core/station/impl/src/mappers/request_policy.rs index baa2df87a..1b186a4e3 100644 --- a/core/station/impl/src/mappers/request_policy.rs +++ b/core/station/impl/src/mappers/request_policy.rs @@ -166,8 +166,6 @@ impl From for UserSpecifier { .map(|id| *HelperMapper::to_uuid(id).expect("invalid uuid").as_bytes()) .collect(), ), - UserSpecifierDTO::Owner => UserSpecifier::Owner, - UserSpecifierDTO::Requester => UserSpecifier::Requester, } } } @@ -186,8 +184,6 @@ impl From for UserSpecifierDTO { .map(|id| Uuid::from_bytes(id).hyphenated().to_string()) .collect::>(), ), - UserSpecifier::Owner => UserSpecifierDTO::Owner, - UserSpecifier::Requester => UserSpecifierDTO::Requester, } } } diff --git a/core/station/impl/src/models/request_specifier.rs b/core/station/impl/src/models/request_specifier.rs index d5bc08c90..fb87554ea 100644 --- a/core/station/impl/src/models/request_specifier.rs +++ b/core/station/impl/src/models/request_specifier.rs @@ -1,16 +1,14 @@ -use super::resource::{Resource, ResourceId, ResourceIds, UserResourceAction}; -use super::{MetadataItem, Request, RequestId, RequestKey, RequestOperation, RequestOperationType}; -use crate::errors::RecordValidationError; -use crate::models::user::User; -use crate::repositories::{ADDRESS_BOOK_REPOSITORY, REQUEST_REPOSITORY}; - +use super::resource::{Resource, ResourceIds}; +use super::{MetadataItem, Request, RequestId, RequestOperation, RequestOperationType}; use crate::core::validation::{ EnsureAccount, EnsureAddressBookEntry, EnsureIdExists, EnsureRequestPolicy, EnsureResourceIdExists, EnsureUser, EnsureUserGroup, }; +use crate::errors::RecordValidationError; +use crate::models::user::User; +use crate::repositories::ADDRESS_BOOK_REPOSITORY; use crate::services::ACCOUNT_SERVICE; use crate::{errors::MatchError, repositories::USER_REPOSITORY}; -use anyhow::anyhow; use orbit_essentials::model::{ModelValidator, ModelValidatorResult}; use orbit_essentials::repository::Repository; use orbit_essentials::storable; @@ -23,14 +21,12 @@ pub enum UserSpecifier { Any, Group(Vec), Id(Vec), - Owner, - Requester, } impl ModelValidator for UserSpecifier { fn validate(&self) -> Result<(), RecordValidationError> { match self { - UserSpecifier::Any | UserSpecifier::Owner | UserSpecifier::Requester => Ok(()), + UserSpecifier::Any => Ok(()), UserSpecifier::Group(group_ids) => { for group_id in group_ids { EnsureUserGroup::id_exists(group_id)?; @@ -195,34 +191,6 @@ impl Match for UserMatcher { Ok(false) } UserSpecifier::Id(ids) => Ok(ids.contains(&input.user_id)), - UserSpecifier::Owner => { - for resource in input.request_operation_resources { - let is_match = match resource { - Resource::User(UserResourceAction::Update(user_resource)) => { - match user_resource { - ResourceId::Any => false, // not a real match - ResourceId::Id(edit_user_id) => edit_user_id == input.user_id, - } - } - _ => false, - }; - - if is_match { - return Ok(true); - } - } - - Ok(false) - } - UserSpecifier::Requester => { - if let Some(request) = REQUEST_REPOSITORY.get(&RequestKey { - id: input.request_id, - }) { - Ok(request.requested_by == input.user_id) - } else { - Err(MatchError::UnexpectedError(anyhow!("Request not found"))) - } - } } } } @@ -497,11 +465,6 @@ mod tests { [1; 16], // approver UserSpecifier::Id(vec![[1; 16]]), // specifier ), - ( - [0; 16], // requester - [0; 16], // approver - UserSpecifier::Requester, // specifier - ), ]; for tc in tcs { @@ -528,12 +491,6 @@ mod tests { disable_mock_resource_validation(); UserSpecifier::Any.validate().expect("Any should be valid"); - UserSpecifier::Owner - .validate() - .expect("Owner should be valid"); - UserSpecifier::Requester - .validate() - .expect("Requester should be valid"); } #[test] diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 537d6e2d5..6b69fbea6 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -229,7 +229,7 @@ while [[ $# -gt 0 ]]; do ;; --production) shift - set_network prod + set_network production exec_function setup_enviroment identity_warning_confirmation exec_function deploy_control_panel diff --git a/tests/integration/src/transfer_tests.rs b/tests/integration/src/transfer_tests.rs index b6299935f..741e3b31a 100644 --- a/tests/integration/src/transfer_tests.rs +++ b/tests/integration/src/transfer_tests.rs @@ -54,13 +54,13 @@ fn make_transfer_successful() { }, transfer_request_policy: Some(RequestPolicyRuleDTO::QuorumPercentage( QuorumPercentageDTO { - approvers: UserSpecifierDTO::Owner, + approvers: UserSpecifierDTO::Id(vec![user_dto.id.clone()]), min_approved: 100, }, )), configs_request_policy: Some(RequestPolicyRuleDTO::QuorumPercentage( QuorumPercentageDTO { - approvers: UserSpecifierDTO::Owner, + approvers: UserSpecifierDTO::Id(vec![user_dto.id.clone()]), min_approved: 100, }, )),