当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationUser类代码示例

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


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


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