Search in sources :

Example 21 with User

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;
}
Also used : GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson) User(org.gluu.oxtrust.model.scim2.User) ScimPatchUser(org.gluu.oxtrust.model.scim2.ScimPatchUser) Operation(org.gluu.oxtrust.model.scim2.Operation)

Example 22 with User

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;
}
Also used : GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson) User(org.gluu.oxtrust.model.scim2.User) ScimPatchUser(org.gluu.oxtrust.model.scim2.ScimPatchUser) EntryPersistenceException(org.gluu.site.ldap.persistence.exception.EntryPersistenceException) DuplicateEntryException(org.gluu.site.ldap.exception.DuplicateEntryException) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) Date(java.util.Date)

Example 23 with User

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);
    }
}
Also used : User(me.zhanghai.android.douya.network.api.info.apiv2.User) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser)

Example 24 with 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);
    }
}
Also used : Account(android.accounts.Account) User(me.zhanghai.android.douya.network.api.info.apiv2.User) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) ArrayList(java.util.ArrayList) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView)

Example 25 with User

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);
    }
}
Also used : SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) User(me.zhanghai.android.douya.network.api.info.apiv2.User) Intent(android.content.Intent)

Aggregations

User (pl.plajer.villagedefense3.User)30 Player (org.bukkit.entity.Player)18 User (org.gluu.oxtrust.model.scim2.User)17 User (org.openstack4j.model.identity.v3.User)13 EventHandler (org.bukkit.event.EventHandler)11 Test (org.junit.Test)11 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)10 ScimPatchUser (org.gluu.oxtrust.model.scim2.ScimPatchUser)10 Date (java.util.Date)9 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder)8 Arena (pl.plajer.villagedefense3.arena.Arena)8 User (me.zhanghai.android.douya.network.api.info.apiv2.User)7 User (com.google.api.ads.admanager.axis.v202108.User)6 User (com.google.api.ads.admanager.axis.v202202.User)6 UserServiceInterface (com.google.api.ads.admanager.axis.v202202.UserServiceInterface)6 ArrayList (java.util.ArrayList)6 SimpleUser (me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser)6 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)6 User (com.google.api.ads.admanager.axis.v202205.User)5 UserServiceInterface (com.google.api.ads.admanager.axis.v202205.UserServiceInterface)5