remove unused code

Change-Id: I751838db3e5122e9991f9e78a6f7814e53340cb7
Signed-off-by: maliang <maliang34@huawei.com>
This commit is contained in:
maliang 2024-11-21 19:42:17 +08:00
parent c21d782b0a
commit d8ac3e735b
4 changed files with 20 additions and 26 deletions

View File

@ -33,7 +33,6 @@ public:
private:
OsAccountType type_;
DomainAccountInfo domainAccountInfo_;
CreateOsAccountForDomainOptions accountOptions_;
sptr<IDomainAccountCallback> innerCallback_ = nullptr;
};
@ -47,7 +46,6 @@ public:
private:
std::shared_ptr<IOsAccountControl> osAccountControl_;
DomainAccountInfo domainAccountInfo_;
OsAccountInfo osAccountInfo_;
sptr<IDomainAccountCallback> innerCallback_ = nullptr;
};

View File

@ -39,9 +39,6 @@ public:
private:
std::shared_ptr<AccountFileOperator> accountFileOperator_;
Json constraintsConfig_;
Json baseOsAccountConstraintsConfig_;
Json globalOsAccountConstraintsConfig_;
Json specificOsAccountConstraintsConfig_;
std::vector<std::string> constraintList_;
bool isAlreadyInit_;
};

View File

@ -31,7 +31,7 @@ namespace AccountSA {
CheckAndCreateDomainAccountCallback::CheckAndCreateDomainAccountCallback(
const OsAccountType &type, const DomainAccountInfo &domainAccountInfo,
const sptr<IDomainAccountCallback> &callback, const CreateOsAccountForDomainOptions &accountOptions)
: type_(type), domainAccountInfo_(domainAccountInfo), accountOptions_(accountOptions), innerCallback_(callback)
: type_(type), accountOptions_(accountOptions), innerCallback_(callback)
{}
void CheckAndCreateDomainAccountCallback::OnResult(int32_t errCode, Parcel &parcel)
@ -71,8 +71,7 @@ void CheckAndCreateDomainAccountCallback::OnResult(int32_t errCode, Parcel &parc
BindDomainAccountCallback::BindDomainAccountCallback(
std::shared_ptr<IOsAccountControl> &osAccountControl, const DomainAccountInfo &domainAccountInfo,
const OsAccountInfo &osAccountInfo, const sptr<IDomainAccountCallback> &callback)
: osAccountControl_(osAccountControl), domainAccountInfo_(domainAccountInfo),
osAccountInfo_(osAccountInfo), innerCallback_(callback)
: osAccountControl_(osAccountControl), osAccountInfo_(osAccountInfo), innerCallback_(callback)
{}
void BindDomainAccountCallback::OnResult(int32_t errCode, Parcel &parcel)

View File

@ -25,9 +25,6 @@ OsAccountFileOperator::OsAccountFileOperator()
accountFileOperator_ = std::make_shared<AccountFileOperator>();
isAlreadyInit_ = false;
constraintsConfig_.clear();
baseOsAccountConstraintsConfig_.clear();
globalOsAccountConstraintsConfig_.clear();
specificOsAccountConstraintsConfig_.clear();
constraintList_.clear();
}
OsAccountFileOperator::~OsAccountFileOperator()
@ -87,21 +84,22 @@ ErrCode OsAccountFileOperator::GetConstraintsByType(const int type, std::vector<
ErrCode OsAccountFileOperator::GetBaseOAConstraintsList(const int id, std::vector<std::string> &constraints)
{
Json baseOsAccountConstraintsConfig;
if (accountFileOperator_->IsExistFile(Constants::BASE_OSACCOUNT_CONSTRAINTS_JSON_PATH)) {
std::string baseUserConstraintsConfigStr;
accountFileOperator_->GetFileContentByPath(
Constants::BASE_OSACCOUNT_CONSTRAINTS_JSON_PATH, baseUserConstraintsConfigStr);
baseOsAccountConstraintsConfig_ = Json::parse(baseUserConstraintsConfigStr, nullptr, false);
if (baseOsAccountConstraintsConfig_.is_discarded()) {
baseOsAccountConstraintsConfig = Json::parse(baseUserConstraintsConfigStr, nullptr, false);
if (baseOsAccountConstraintsConfig.is_discarded()) {
return ERR_OSACCOUNT_SERVICE_GET_DATA_FROM_BASE_CONSTRAINTS_FILE_EMPTY;
}
}
if (baseOsAccountConstraintsConfig_.size() == 0) {
if (baseOsAccountConstraintsConfig.size() == 0) {
ACCOUNT_LOGE("baseOsAccountConstraints data is empty");
return ERR_OSACCOUNT_SERVICE_GET_DATA_FROM_BASE_CONSTRAINTS_FILE_EMPTY;
}
OHOS::AccountSA::GetDataByType<std::vector<std::string>>(baseOsAccountConstraintsConfig_,
baseOsAccountConstraintsConfig_.end(),
OHOS::AccountSA::GetDataByType<std::vector<std::string>>(baseOsAccountConstraintsConfig,
baseOsAccountConstraintsConfig.end(),
std::to_string(id),
constraints,
OHOS::AccountSA::JsonType::ARRAY);
@ -110,22 +108,23 @@ ErrCode OsAccountFileOperator::GetBaseOAConstraintsList(const int id, std::vecto
ErrCode OsAccountFileOperator::GetGlobalOAConstraintsList(std::vector<std::string> &constraints)
{
Json globalOsAccountConstraintsConfig;
if (accountFileOperator_->IsExistFile(Constants::GLOBAL_OSACCOUNT_CONSTRAINTS_JSON_PATH)) {
std::string globalOsAccountConstraintsConfigStr;
accountFileOperator_->GetFileContentByPath(
Constants::GLOBAL_OSACCOUNT_CONSTRAINTS_JSON_PATH, globalOsAccountConstraintsConfigStr);
globalOsAccountConstraintsConfig_ = Json::parse(globalOsAccountConstraintsConfigStr, nullptr, false);
if (globalOsAccountConstraintsConfig_.is_discarded()) {
globalOsAccountConstraintsConfig = Json::parse(globalOsAccountConstraintsConfigStr, nullptr, false);
if (globalOsAccountConstraintsConfig.is_discarded()) {
return ERR_OSACCOUNT_SERVICE_GET_DATA_FROM_GLOBAL_CONSTRAINTS_FILE_EMPTY;
}
}
if (globalOsAccountConstraintsConfig_.size() == 0) {
if (globalOsAccountConstraintsConfig.size() == 0) {
ACCOUNT_LOGE("globalOsAccountConstraints data is empty");
return ERR_OSACCOUNT_SERVICE_GET_DATA_FROM_GLOBAL_CONSTRAINTS_FILE_EMPTY;
}
OHOS::AccountSA::GetDataByType<std::vector<std::string>>(globalOsAccountConstraintsConfig_,
globalOsAccountConstraintsConfig_.end(),
OHOS::AccountSA::GetDataByType<std::vector<std::string>>(globalOsAccountConstraintsConfig,
globalOsAccountConstraintsConfig.end(),
Constants::ALL_GLOBAL_CONSTRAINTS,
constraints,
OHOS::AccountSA::JsonType::ARRAY);
@ -134,23 +133,24 @@ ErrCode OsAccountFileOperator::GetGlobalOAConstraintsList(std::vector<std::strin
ErrCode OsAccountFileOperator::GetSpecificOAConstraintsList(const int id, std::vector<std::string> &constraints)
{
Json specificOsAccountConstraintsConfig;
if (accountFileOperator_->IsExistFile(Constants::SPECIFIC_OSACCOUNT_CONSTRAINTS_JSON_PATH)) {
std::string specificOsAccountConstraintsConfigStr;
accountFileOperator_->GetFileContentByPath(
Constants::SPECIFIC_OSACCOUNT_CONSTRAINTS_JSON_PATH, specificOsAccountConstraintsConfigStr);
specificOsAccountConstraintsConfig_ = Json::parse(specificOsAccountConstraintsConfigStr, nullptr, false);
if (specificOsAccountConstraintsConfig_.is_discarded()) {
specificOsAccountConstraintsConfig = Json::parse(specificOsAccountConstraintsConfigStr, nullptr, false);
if (specificOsAccountConstraintsConfig.is_discarded()) {
return ERR_OSACCOUNT_SERVICE_GET_DATA_FROM_SPECIFIC_CONSTRAINTS_FILE_EMPTY;
}
}
if (specificOsAccountConstraintsConfig_.size() == 0) {
if (specificOsAccountConstraintsConfig.size() == 0) {
ACCOUNT_LOGE("globalOsAccountConstraints data is empty");
return ERR_OSACCOUNT_SERVICE_GET_DATA_FROM_SPECIFIC_CONSTRAINTS_FILE_EMPTY;
}
Json SpecificOAConstraintsData;
OHOS::AccountSA::GetDataByType<Json>(specificOsAccountConstraintsConfig_,
specificOsAccountConstraintsConfig_.end(),
OHOS::AccountSA::GetDataByType<Json>(specificOsAccountConstraintsConfig,
specificOsAccountConstraintsConfig.end(),
std::to_string(id),
SpecificOAConstraintsData,
OHOS::AccountSA::JsonType::OBJECT);