• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ApplicationUser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.isisaddons.module.security.dom.user.ApplicationUser的典型用法代码示例。如果您正苦于以下问题:Java ApplicationUser类的具体用法?Java ApplicationUser怎么用?Java ApplicationUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ApplicationUser类属于org.isisaddons.module.security.dom.user包,在下文中一共展示了ApplicationUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: userProfileName

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
@Programmatic
public String userProfileName() {
    final ApplicationUser applicationUser = meService.me();

    final StringBuilder buf = new StringBuilder();
    final String username = applicationUser.getName();
    final ApplicationTenancy tenancy = applicationUser.getTenancy();

    buf.append("Hi ");
    buf.append(username);
    if (tenancy.getName() != null) {
        buf.append(" @").append(tenancy.getName());
    }

    return buf.toString();
}
 
开发者ID:bibryam,项目名称:rotabuilder,代码行数:18,代码来源:UserProfileServiceShowingTenancy.java


示例2: hides

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
public String hides(Object domainObject, ApplicationUser applicationUser) {
    if (!(domainObject instanceof AbstractPersistable)) {
        return null;
    }

    final AbstractPersistable persistable = (AbstractPersistable) domainObject;
    final ApplicationTenancy applicationUserTenancy = applicationUser.getTenancy();
    final ApplicationTenancy persistableApplicationTenancy = persistable.getApplicationTenancy();

    if (applicationUserTenancy == null || persistableApplicationTenancy == null) {
        return "missing tenancy";
    }

    return applicationUserTenancy.equals(persistableApplicationTenancy) ? null: "different tenancies";
}
 
开发者ID:bibryam,项目名称:rotabuilder,代码行数:17,代码来源:ApplicationTenancyEvaluatorForRoster.java


示例3: registerUser

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
public void registerUser(
        final UserDetails userDetails) {

    final Password password = new Password(userDetails.getPassword());
    final ApplicationRole initialRole = getInitialRole();
    final Boolean enabled = true;
    final String username = userDetails.getUsername();
    final String emailAddress = userDetails.getEmailAddress();
    final ApplicationUser applicationUser = applicationUserRepository.newLocalUser(username, password, password, initialRole, enabled, emailAddress);

    final Set<ApplicationRole> additionalRoles = getAdditionalInitialRoles();
    if(additionalRoles != null) {
        for (final ApplicationRole additionalRole : additionalRoles) {
            applicationUser.addRole(additionalRole);
        }
    }

    // set up new user custom
    final ApplicationTenancy applicationTenancy = applicationTenancyRepository.newTenancy(username, "/" + username, null);
    applicationUser.setAtPath(applicationTenancy.getPath());

    fixtureScripts.runFixtureScript(new SematFixture(username, Arrays.asList(SudoService.ACCESS_ALL_ROLE)), null);
}
 
开发者ID:bibryam,项目名称:semat,代码行数:25,代码来源:AppUserRegistrationService.java


示例4: userProfileName

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
@Programmatic
public String userProfileName() {
    final ApplicationUser applicationUser = meService.me();

    final StringBuilder buf = new StringBuilder();
    final String username = applicationUser.getName();
    final String atPath = applicationUser.getAtPath();
    final ApplicationTenancy tenancy = applicationTenancyRepository.findByPath(atPath);

    buf.append("Hi ");
    buf.append(username);
    if (tenancy.getName() != null) {
        buf.append(" @").append(tenancy.getName());
    }

    return buf.toString();
}
 
开发者ID:bibryam,项目名称:semat,代码行数:19,代码来源:UserProfileServiceShowingTenancy.java


示例5: hides

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
public String hides(Object domainObject, ApplicationUser applicationUser) {
    if (!(domainObject instanceof AbstractPersistable)) {
        return null;
    }

    final AbstractPersistable persistable = (AbstractPersistable) domainObject;
    final String atPath = applicationUser.getAtPath();
    final ApplicationTenancy applicationUserTenancy = applicationTenancyRepository.findByPath(atPath);
    final ApplicationTenancy persistableApplicationTenancy = persistable.getApplicationTenancy();

    if (applicationUserTenancy == null || persistableApplicationTenancy == null) {
        return "missing tenancy";
    }

    return applicationUserTenancy.equals(persistableApplicationTenancy) ? null: "different tenancies";
}
 
开发者ID:bibryam,项目名称:semat,代码行数:18,代码来源:SematApplicationTenancyEvaluator.java


示例6: userProfileName

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
@Programmatic
public String userProfileName() {
    final ApplicationUser applicationUser = meService.me();

    final StringBuilder buf = new StringBuilder();
    final String username = applicationUser.getName();
    final ApplicationTenancy tenancy = applicationUser.getTenancy();

    buf.append("Hi ");
    buf.append(username);
    if (!tenancy.getPath().equals(UsersTenancy.TENANCY_PATH + username)) {
        buf.append(" @").append(tenancy.getName());
    }

    return buf.toString();
}
 
开发者ID:isisaddons-legacy,项目名称:isis-app-quickstart,代码行数:18,代码来源:UserProfileServiceShowingTenancy.java


示例7: create

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
protected ApplicationUser create(
    final String name,
    final String emailAddress,
    final AccountType accountType,
    final String tenancyPath,
    final ExecutionContext executionContext) {

    final ApplicationUser applicationUser;
    if(accountType == AccountType.DELEGATED) {
        applicationUser = applicationUserRepository.newDelegateUser(name, null, null);
    } else {
        final String passwordStr = Util.coalesce(executionContext.getParameter("password"), getPassword(), "12345678a");
        final Password password = new Password(passwordStr);
        applicationUser = applicationUserRepository.newLocalUser(name, password, password, null, null, emailAddress);
    }

    applicationUser.setAtPath(tenancyPath);

    executionContext.addResult(this, name, applicationUser);
    return applicationUser;
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:22,代码来源:AbstractUserFixtureScript.java


示例8: happyCase

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Test
public void happyCase() throws Exception {

    // given
    final ApplicationRole fredsRole = applicationRoleRepository.newRole("role1", "role1");
    final ApplicationUser fred = applicationUserRepository
            .newLocalUser("fred", new Password("fredPass"), new Password("fredPass"), fredsRole, true,
                    "[email protected]");

    // when
    final ApplicationUser fredsClone = applicationUserRepository
            .newLocalUserBasedOn("fredsClone", new Password("fredClonePass"), new Password("fredClonePass"),
                    fred, true, "[email protected]");

    // then
    assertThat(fred.getRoles(), is(fredsClone.getRoles()));
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:18,代码来源:ApplicationUserRepositoryIntegTest.java


示例9: whenUserHaveDifferentRoles

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Test
public void whenUserHaveDifferentRoles() throws Exception {

    // given
    final ApplicationRole fredsRole = applicationRoleRepository.newRole("role1", "role2");
    final ApplicationUser fred = applicationUserRepository
            .newLocalUser("fred", new Password("fredPass"), new Password("fredPass"), fredsRole, true,
                    "[email protected]");

    // when
    final ApplicationUser fredsClone = applicationUserRepository
            .newLocalUserBasedOn("fredsClone", new Password("fredClonePass"), new Password("fredClonePass"),
                    fred, true, "[email protected]");

    // and when
    fredsClone.addRole(applicationRoleRepository.newRole("role2", "role2"));

    // then
    assertNotEquals(fred.getRoles(), fredsClone.getRoles());
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:21,代码来源:ApplicationUserRepositoryIntegTest.java


示例10: hides

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
public String hides(Object domainObject, ApplicationUser applicationUser) {

    // eg /x/y
    String objectTenancyPath = applicationTenancyPathForCached(domainObject);
    if (objectTenancyPath == null) {
        return null;
    }

    // eg /x  or /x/y/z
    String userTenancyPath = userTenancyPathForCached(applicationUser);
    if (userTenancyPath == null) {
        return "User has no tenancy";
    }

    if (objectVisibleToUser(objectTenancyPath, userTenancyPath)) {
        return null;
    }

    // it's ok to return this info, because it isn't actually rendered (helpful if debugging)
    return String.format(
            "User with tenancy '%s' is not permitted to view object with tenancy '%s'",
            userTenancyPath,
            objectTenancyPath);
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:26,代码来源:ApplicationTenancyEvaluatorUsingPaths.java


示例11: disables

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
public String disables(Object domainObject, ApplicationUser applicationUser) {

    // eg /x/y
    String objectTenancyPath = applicationTenancyPathForCached(domainObject);
    if (objectTenancyPath == null) {
        return null;
    }

    // eg /x  or /x/y/z
    String userTenancyPath = userTenancyPathForCached(applicationUser);
    if (userTenancyPath == null) {
        return "User has no tenancy";
    }

    if (objectEnabledForUser(objectTenancyPath, userTenancyPath)) {
        return null;
    }

    return String.format(
            "User with tenancy '%s' is not permitted to edit object with tenancy '%s'",
            userTenancyPath,
            objectTenancyPath);
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:25,代码来源:ApplicationTenancyEvaluatorUsingPaths.java


示例12: hides

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
public String hides(final VisibilityContext<? extends VisibilityEvent> ic) {

    if(evaluators == null || evaluators.isEmpty()) {
        return null;
    }

    final Object domainObject = ic.getTarget().getObject();
    final String userName = userService.getUser().getName();

    final ApplicationUser applicationUser = findApplicationUser(userName);
    if (applicationUser == null) {
        // not expected, but best to be safe...
        return "Could not locate application user for " + userName;
    }

    for (ApplicationTenancyEvaluator evaluator : evaluators) {
        final String reason = evaluator.hides(domainObject, applicationUser);
        if(reason != null) {
            return reason;
        }
    }
    return null;
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:25,代码来源:TenantedAuthorizationFacetDefault.java


示例13: disables

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
public String disables(final UsabilityContext<? extends UsabilityEvent> ic) {
    if(evaluators == null || evaluators.isEmpty()) {
        return null;
    }

    final Object domainObject = ic.getTarget().getObject();
    final String userName = userService.getUser().getName();

    final ApplicationUser applicationUser = findApplicationUser(userName);
    if (applicationUser == null) {
        // not expected, but best to be safe...
        return "Could not locate application user for " + userName;
    }

    for (ApplicationTenancyEvaluator evaluator : evaluators) {
        final String reason = evaluator.disables(domainObject, applicationUser);
        if(reason != null) {
            return reason;
        }
    }
    return null;
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:24,代码来源:TenantedAuthorizationFacetDefault.java


示例14: registerUser

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
public void registerUser(
    final UserDetails userDetails) {

    final Password password = new Password(userDetails.getPassword());
    final ApplicationRole initialRole = getInitialRole();
    final Boolean enabled = true;
    final String username = userDetails.getUsername();
    final String emailAddress = userDetails.getEmailAddress();
    final ApplicationUser applicationUser = applicationUserRepository.newLocalUser(username, password, password, initialRole, enabled, emailAddress);

    final Set<ApplicationRole> additionalRoles = getAdditionalInitialRoles();
    if(additionalRoles != null) {
        for (final ApplicationRole additionalRole : additionalRoles) {
            applicationUser.addRole(additionalRole);
        }
    }

}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:20,代码来源:SecurityModuleAppUserRegistrationServiceAbstract.java


示例15: me

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Action(
        domainEvent = MeDomainEvent.class,
        semantics = SemanticsOf.SAFE
)
@ActionLayout(
        cssClassFa = "fa-user",
        describedAs = "Looks up ApplicationUser entity corresponding to your user account"
)
@MemberOrder(name = "Security", sequence = "100")
public ApplicationUser me() {
    return queryResultsCache.execute(new Callable<ApplicationUser>() {
        @Override
        public ApplicationUser call() throws Exception {
            return doMe();
        }
    }, MeService.class, "me");
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:18,代码来源:MeService.java


示例16: lookupPrincipal

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
/**
 * @param username
 * @param autoCreateUser
 */
private PrincipalForApplicationUser lookupPrincipal(final String username, final boolean autoCreateUser) {
    return execute(new TransactionalClosureWithReturnAbstract<PrincipalForApplicationUser>() {
        @Override
        public PrincipalForApplicationUser execute() {
            final ApplicationUser applicationUser = lookupUser();
            return PrincipalForApplicationUser.from(applicationUser);
        }

        private ApplicationUser lookupUser() {
            if (autoCreateUser) {
                return applicationUserRepository.findOrCreateUserByUsername(username);
            } else {
                return applicationUserRepository.findByUsername(username);
            }
        }

        @Inject
        private ApplicationUserRepository applicationUserRepository;
    });
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:25,代码来源:IsisModuleSecurityRealm.java


示例17: impersonate

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Action(restrictTo = RestrictTo.PROTOTYPING)
@MemberOrder(sequence = "1")
public void impersonate(
        final ApplicationUser applicationUser,
        @Nullable
        final List<ApplicationRole> applicationRoleList) {

    if(estatioUserService.isImpersonating()) {
        stopImpersonating();
    }

    final List<String> roleNames = asRoleNames(applicationRoleList);

    estatioUserService.setUser(applicationUser.getUsername(), roleNames);

    messageService.informUser("Now impersonating " + applicationUser.getName());

}
 
开发者ID:estatio,项目名称:estatio,代码行数:19,代码来源:EstatioImpersonateMenu.java


示例18: execute

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Override
protected void execute(ExecutionContext executionContext) {

    checkParam("person", executionContext, Person.class);
    checkParam("securityUsername", executionContext, String.class);

    defaultParam("securityUserAccountCloneFrom", executionContext, "estatio-admin");


    if(securityUsername != null) {
        ApplicationUser userToCloneFrom = applicationUserRepository.findByUsername(securityUserAccountCloneFrom);
        if(userToCloneFrom == null) {
            throw new IllegalArgumentException("Could not find any user with username: " + securityUserAccountCloneFrom);
        }

        object = applicationUserRepository.newLocalUserBasedOn(
                securityUsername,
                new Password("pass"), new Password("pass"),
                userToCloneFrom, true, null);
        object.setAtPath(person.getAtPath());
        person.setUsername(securityUsername);

        executionContext.addResult(this, securityUsername, userToCloneFrom);
    }
}
 
开发者ID:estatio,项目名称:estatio,代码行数:26,代码来源:ApplicationUserBuilder.java


示例19: choices0Act

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
public List<String> choices0Act() {

            // REVIEW: really naive code, ought to move this logic into a repository?
            final List<String> usernames =
                    Lists.newArrayList(
                            applicationUserRepository.allUsers().stream()
                                    .map(ApplicationUser::getUsername)
                                    .collect(Collectors.toList())
                    );

            final List<String> userNamesInUse =
                    personRepository.allPersons().stream()
                    .map(Person::getUsername)
                    .filter(Objects::nonNull)
                    .collect(Collectors.toList());

            usernames.removeAll(userNamesInUse);
            return usernames;
        }
 
开发者ID:estatio,项目名称:estatio,代码行数:20,代码来源:Person.java


示例20: happyCase

import org.isisaddons.module.security.dom.user.ApplicationUser; //导入依赖的package包/类
@Test
public void happyCase() {

    // given
    final ApplicationUser user = new ApplicationUser();
    context.checking(new Expectations() {{
        allowing(mockMeService).me();
        will(returnValue(user));
    }});
    user.setAtPath("/ITA");


    // when
    propertyRepository.autoComplete("X?yz");

    // then
    assertThat(finderInteraction.getFinderMethod()).isEqualTo(FinderInteraction.FinderMethod.ALL_MATCHES);
    assertThat(finderInteraction.getResultType()).isEqualTo(Property.class);
    assertThat(finderInteraction.getQueryName()).isEqualTo("findByReferenceOrName");

    final Map<String, Object> argsByParam = finderInteraction.getArgumentsByParameterName();
    assertThat(argsByParam.get("referenceOrName")).isEqualTo((Object) "(?i).*X.yz.*");
    assertThat(argsByParam).hasSize(1);
}
 
开发者ID:estatio,项目名称:estatio,代码行数:25,代码来源:PropertyRepository_Test.java



注:本文中的org.isisaddons.module.security.dom.user.ApplicationUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DValuePattern类代码示例发布时间:2022-05-22
下一篇:
Java ODataFeed类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap