Create user resource boolean.

@param p          the p
@param credential the credential
@return the boolean
973319
@SneakyThrows
    protected boolean createUserResource(final Principal p, final Credential credential) {
        val user = new UserResource();
        this.mapper.map(user, p, credential);
        return scimService.create("Users", user) != null;
    }
986652
@Override
    protected final Principal getPrincipal(final Credentials credentials) {
        try {
            Optional<Principal> principalOptional = cache.get(credentials.getApiKey(), new Callable<Optional<Principal>>() {
                public Optional<Principal> call() throws Exception {
                    return Optional.fromNullable(loadPrincipal(credentials));
                }
            });
            return principalOptional.orNull();
        } catch (ExecutionException e) {
            LOG.warn("Exception when loading the cache for credentials with API key " + credentials.getApiKey());
            return null;
        }
    }
494922
private static boolean validParameter(final Parameter p) {
        if (p.getNamespace() == null) {
            return false;
        }
        if (p.getValue() == null) {
            return false;
        }
        return true;
    }
484426
public Result<Void> createPerm(AuthzTrans trans, PermDAO.Data perm, boolean fromApproval) {
		String user = trans.user();
		// Next, see if User is allowed to Manage Parent Permission

		Result<NsDAO.Data> rnsd;
		if (!fromApproval) {
			rnsd = q.mayUser(trans, user, perm, Access.write);
			if (rnsd.notOK()) {
				return Result.err(rnsd);
			}
		} else {
			rnsd = q.deriveNs(trans, perm.ns);
		}

		// Does Child exist?
		if (!trans.forceRequested()) {
			if (q.permDAO.read(trans, perm).isOKhasData()) {
				return Result.err(Status.ERR_ConflictAlreadyExists,
						"Permission [%s.%s|%s|%s] already exists.", perm.ns,
						perm.type, perm.instance, perm.action);
			}
		}

		// Attempt to add perms to roles, creating as possible
		Set<String> roles;
		String pstring = perm.encode();

		// For each Role
		for (String role : roles = perm.roles(true)) {
			Result<RoleDAO.Data> rdd = RoleDAO.Data.decode(trans,q,role);
			if(rdd.isOKhasData()) {
				RoleDAO.Data rd = rdd.value;
				if (!fromApproval) {
					// May User write to the Role in question.
					Result<NsDAO.Data> rns = q.mayUser(trans, user, rd,
							Access.write);
					if (rns.notOK()) {
						// Remove the role from Add, because
						roles.remove(role); // Don't allow adding
						trans.warn()
								.log("User [%s] does not have permission to relate Permissions to Role [%s]",
										user, role);
					}
				}

				Result<List<RoleDAO.Data>> rlrd;
				if ((rlrd = q.roleDAO.read(trans, rd)).notOKorIsEmpty()) {
					rd.perms(true).add(pstring);
					if (q.roleDAO.create(trans, rd).notOK()) {
						roles.remove(role); // Role doesn't exist, and can't be
											// created
					}
				} else {
					rd = rlrd.value.get(0);
					if (!rd.perms.contains(pstring)) {
						q.roleDAO.addPerm(trans, rd, perm);
					}
				}
			}
		}

		Result<PermDAO.Data> pdr = q.permDAO.create(trans, perm);
		if (pdr.isOK()) {
			return Result.ok();
		} else { 
			return Result.err(pdr);
		}
	}
850993
public Credential loadCredential(String userId) throws AuthException {
        try {
            return authorizationCodeFlow.loadCredential(userId);
        } catch (IOException e) {
            throw new AuthException("Unable to load credential.", e);
        }
    }
192134
public boolean check(Object credentials)
    {
	if (this == credentials)
	    return true;
	
        if (credentials instanceof Password)
            return credentials.equals(_pw);
        
        if (credentials instanceof String)
            return credentials.equals(_pw);
        
        if (credentials instanceof Credential)
            return ((Credential)credentials).check(_pw);
            
        return false;
    }
1085948
@Override
    public boolean authorizeURLRequest(Request.Builder builder) {
        if (authUserInfo() == null)
            return false;
        String credential = Credentials.basic(username, password);
        builder.addHeader("Authorization", credential);
        return true;
    }
1214263
public static void actionCreate(PageContext pc, Resource directory, String serverPassword, boolean createPath, int mode, Object acl, String storage, int nameConflict)
	    throws PageException {

	SecurityManager securityManager = pc.getConfig().getSecurityManager();
	securityManager.checkFileLocation(pc.getConfig(), directory, serverPassword);

	if (directory.exists()) {
	    if (directory.isDirectory()) {
		if (nameConflict == NAMECONFLICT_SKIP) return;

		throw new ApplicationException("directory [" + directory.toString() + "] already exist");
	    }
	    else if (directory.isFile()) throw new ApplicationException("can't create directory [" + directory.toString() + "], it exist a file with same name");
	}
	// if(!directory.mkdirs()) throw new ApplicationException("can't create directory
	// ["+directory.toString()+"]");
	try {
	    directory.createDirectory(createPath);
	}
	catch (IOException ioe) {
	    throw Caster.toPageException(ioe);
	}

	// set S3 stuff
	setS3Attrs(pc, directory, acl, storage);

	// Set Mode
	if (mode != -1) {
	    try {
		directory.setMode(mode);
		// FileUtil.setMode(directory,mode);
	    }
	    catch (IOException e) {
		throw Caster.toPageException(e);
	    }
	}
    }
716541
public <T extends AbstractGoogleJsonClient.Builder> T fromCredential(T builder, Credential credential) {
    Preconditions.checkNotNull(builder);
    Preconditions.checkNotNull(credential);
    return prepareBuilder(builder, credential, null);
  }
182735
public static boolean isAdmin(IPerson p) {
        IAuthorizationPrincipal iap =
                AuthorizationServiceFacade.instance()
                        .newPrincipal(
                                p.getEntityIdentifier().getKey(),
                                p.getEntityIdentifier().getType());

        return isAdmin(iap);
    }
1029978
@POST
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Description("Creates a user.")
    public PrincipalUserDto createPrincipalUser(@Context HttpServletRequest req, final PrincipalUserDto userDto) {
        PrincipalUser remoteUser = validateAndGetOwner(req, null);

        validateResourceAuthorization(req, remoteUser, remoteUser);
        if (userDto == null) {
            throw new WebApplicationException("Cannot create a null user.", Status.BAD_REQUEST);
        }

        PrincipalUser user = new PrincipalUser(remoteUser, userDto.getUserName(), userDto.getEmail());

        copyProperties(user, userDto);
        user = _uService.updateUser(user);
        return PrincipalUserDto.transformToDto(user);
    }
639506
@SneakyThrows
    protected boolean updateUserResource(final UserResource user, final Principal p, final Credential credential) {
        this.mapper.map(user, p, credential);
        return endpoint.update(user) != null;
    }
300637
public void verifyCredentials(String username, String password) throws GreenPepperServerException {
        if (username != null && !isCredentialsValid(username, password)) {
            throw new GreenPepperServerException("greenpepper.confluence.badcredentials", "The username and password are incorrect.");
        }
    }
984463
public void createUser(User user, String password){
        ProtocolHeader header = new ProtocolHeader();
        header.setType(ProtocolType.CreateUser);
        byte[] secret = null;
        if(password != null && ! password.isEmpty()){
            secret = ObfuscatUtil.base64Encode(password.getBytes());
        }
        CreateUserProtocol p = new CreateUserProtocol(user, secret);

        connection.submitRequest(header, p, null);
    }
25950
public boolean permissionsContainOwnKeyword(User user, ParaObject object) {
		if (user == null || object == null) {
			return false;
		}
		String resourcePath1 = object.getType();
		String resourcePath2 = object.getObjectURI().substring(1); // remove first '/'
		String resourcePath3 = object.getPlural();
		return hasOwnKeyword(App.ALLOW_ALL, resourcePath1)
				|| hasOwnKeyword(App.ALLOW_ALL, resourcePath2)
				|| hasOwnKeyword(App.ALLOW_ALL, resourcePath3)
				|| hasOwnKeyword(user.getId(), resourcePath1)
				|| hasOwnKeyword(user.getId(), resourcePath2)
				|| hasOwnKeyword(user.getId(), resourcePath3);
	}
987700
public StorageBuilder setUserCredentialsRepository( UserCredentialsRepository userCredentialsRepo, String userId )
    {
        this.userCredentialsRepo = userCredentialsRepo;
        this.userId = userId;

        return this;
    }
768033
public static Boolean getBoolean(Properties p, String name, Boolean defaultValue) {
		return BooleanUtil.toBooleanObject(p.getProperty(name), defaultValue);
	}