use of com.google.api.ads.admanager.axis.v202205.User in project oxTrust by GluuFederation.
the class Scim2UserService method patchUser.
public User patchUser(String id, ScimPatchUser patchUser) throws Exception {
for (Operation operation : patchUser.getOperatons()) {
String val = operation.getOperationName();
if (val.equalsIgnoreCase("replace")) {
replaceUserPatch(operation, id);
}
if (val.equalsIgnoreCase("remove")) {
removeUserPatch(operation, id);
}
if (val.equalsIgnoreCase("add")) {
addUserPatch(operation, id);
}
}
GluuCustomPerson gluuPerson = personService.getPersonByInum(id);
User updatedUser = copyUtils2.copy(gluuPerson, null);
return updatedUser;
}
use of com.google.api.ads.admanager.axis.v202205.User in project oxTrust by GluuFederation.
the class Scim2UserService method updateUser.
public User updateUser(String id, User user) throws Exception {
GluuCustomPerson gluuPerson = personService.getPersonByInum(id);
if (gluuPerson == null) {
throw new EntryPersistenceException("Scim2UserService.updateUser(): " + "Resource " + id + " not found");
} else {
// Validate if attempting to update userName of a different id
if (user.getUserName() != null) {
GluuCustomPerson personToFind = new GluuCustomPerson();
personToFind.setUid(user.getUserName());
List<GluuCustomPerson> foundPersons = personService.findPersons(personToFind, 2);
if (foundPersons != null && foundPersons.size() > 0) {
for (GluuCustomPerson foundPerson : foundPersons) {
if (foundPerson != null && !foundPerson.getInum().equalsIgnoreCase(gluuPerson.getInum())) {
throw new DuplicateEntryException("Cannot update userName of a different id: " + user.getUserName());
}
}
}
}
}
GluuCustomPerson updatedGluuPerson = copyUtils2.copy(user, gluuPerson, true);
if (user.getGroups().size() > 0) {
serviceUtil.groupMembersAdder(updatedGluuPerson, personService.getDnForPerson(id));
}
log.info(" Setting meta: update user ");
// Date should be in UTC format
DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateTime().withZoneUTC();
Date dateLastModified = DateTime.now().toDate();
updatedGluuPerson.setAttribute("oxTrustMetaLastModified", dateTimeFormatter.print(dateLastModified.getTime()));
if (updatedGluuPerson.getAttribute("oxTrustMetaLocation") == null || (updatedGluuPerson.getAttribute("oxTrustMetaLocation") != null && updatedGluuPerson.getAttribute("oxTrustMetaLocation").isEmpty())) {
String relativeLocation = "/scim/v2/Users/" + id;
updatedGluuPerson.setAttribute("oxTrustMetaLocation", relativeLocation);
}
// Sync email, forward ("oxTrustEmail" -> "mail")
updatedGluuPerson = serviceUtil.syncEmailForward(updatedGluuPerson, true);
// For custom script: update user
if (externalScimService.isEnabled()) {
externalScimService.executeScimUpdateUserMethods(updatedGluuPerson);
}
personService.updatePerson(updatedGluuPerson);
log.debug(" person updated ");
User updatedUser = copyUtils2.copy(updatedGluuPerson, null);
return updatedUser;
}
use of com.google.api.ads.admanager.axis.v202205.User in project Douya by DreaminginCodeZH.
the class UserResource method onDestroy.
@Override
public void onDestroy() {
super.onDestroy();
if (has()) {
User user = get();
setArguments(user.getIdOrUid(), user, user);
}
}
use of com.google.api.ads.admanager.axis.v202205.User in project Douya by DreaminginCodeZH.
the class NavigationAccountListLayout method bind.
public void bind() {
List<Account> accountList = new ArrayList<>(Arrays.asList(AccountUtils.getAccounts()));
accountList.remove(AccountUtils.getActiveAccount());
Account recentOneAccount = AccountUtils.getRecentOneAccount();
if (recentOneAccount != null) {
accountList.remove(recentOneAccount);
}
Account recentTwoAccount = AccountUtils.getRecentTwoAccount();
if (recentTwoAccount != null) {
accountList.remove(recentTwoAccount);
}
if (recentOneAccount != null) {
accountList.add(recentOneAccount);
}
if (recentTwoAccount != null) {
accountList.add(recentTwoAccount);
}
int i = 0;
for (final Account account : accountList) {
if (i >= mAccountList.getChildCount()) {
ViewUtils.inflateInto(R.layout.navigation_account_item, mAccountList);
}
View accountLayout = mAccountList.getChildAt(i);
accountLayout.setVisibility(VISIBLE);
AccountLayoutHolder holder = (AccountLayoutHolder) accountLayout.getTag();
if (holder == null) {
holder = new AccountLayoutHolder(accountLayout);
accountLayout.setTag(holder);
}
User user = mAdapter.getUser(account);
if (user != null) {
ImageUtils.loadNavigationAccountListAvatar(holder.avatarImage, user.getLargeAvatarOrAvatar());
} else {
holder.avatarImage.setImageResource(R.drawable.avatar_icon_40dp);
}
holder.nameText.setText(mAdapter.getPartialUser(account).name);
accountLayout.setOnClickListener(view -> {
if (mListener != null) {
mListener.switchToAccount(account);
}
});
++i;
}
ViewUtils.setVisibleOrGone(mDividerView, i > 0);
for (int count = mAccountList.getChildCount(); i < count; ++i) {
mAccountList.getChildAt(i).setVisibility(GONE);
}
}
use of com.google.api.ads.admanager.axis.v202205.User in project Douya by DreaminginCodeZH.
the class ProfileActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(0, 0);
// Calls ensureSubDecor().
findViewById(android.R.id.content);
if (savedInstanceState == null) {
Intent intent = getIntent();
String userIdOrUid = intent.getStringExtra(EXTRA_USER_ID_OR_UID);
SimpleUser simpleUser = intent.getParcelableExtra(EXTRA_SIMPLE_USER);
User user = intent.getParcelableExtra(EXTRA_USER_INFO);
mFragment = ProfileFragment.newInstance(userIdOrUid, simpleUser, user);
FragmentUtils.add(mFragment, this, android.R.id.content);
} else {
mFragment = FragmentUtils.findById(this, android.R.id.content);
}
}
Aggregations