Examples of OSecurityException


Examples of com.orientechnologies.orient.core.exception.OSecurityException

  public void onMessage(String iText) {
  }

  protected void checkConnected() {
    if (!manager.isLeaderConnected())
      throw new OSecurityException("Invalid request from a non-connected node");
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityException

  public OUser create() {
    acquireExclusiveLock();
    try {

      if (getDatabase().getMetadata().getSchema().getClasses().size() > 0)
        throw new OSecurityException("Default users and roles already installed");

      // CREATE ROLE AND USER SCHEMA CLASSES
      final OClass roleClass = getDatabase().getMetadata().getSchema().createClass("ORole");
      roleClass.createProperty("mode", OType.BYTE);
      roleClass.createProperty("rules", OType.EMBEDDEDMAP, OType.BYTE);
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityException

  public OUser create() {
    acquireExclusiveLock();
    try {

      if (getDatabase().getMetadata().getSchema().getClasses().size() > 0)
        throw new OSecurityException("Default users and roles already installed");

      // CREATE ROLE AND USER SCHEMA CLASSES
      final OClass roleClass = getDatabase().getMetadata().getSchema().createClass("ORole");
      roleClass.createProperty("mode", OType.BYTE);
      roleClass.createProperty("rules", OType.EMBEDDEDMAP, OType.BYTE);
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityException

    try {
      kg = KeyGenerator.getInstance(iAlgorithm);
      kg.init(iKeySize);
      return kg.generateKey();
    } catch (Exception e) {
      throw new OSecurityException("Error on generating key for algorithm: " + iAlgorithm, e);
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityException

    try {
      c = Cipher.getInstance(iAlgorithm);
      c.init(Cipher.ENCRYPT_MODE, iKey);
      return c.doFinal(iData);
    } catch (Exception e) {
      throw new OSecurityException("Error on encrypting data", e);
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityException

    try {
      c = Cipher.getInstance(iAlgorithm);
      c.init(Cipher.DECRYPT_MODE, iKey);
      return c.doFinal(iData);
    } catch (Exception e) {
      throw new OSecurityException("Error on decrypting data", e);
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityException

    OMetadata metaData = ODatabaseRecordThreadLocal.INSTANCE.get().getMetadata();
    if (metaData != null) {
      final Set<OClass> classes = metaData.getSchema().getClassesRelyOnCluster(iClusterName);
      for (OClass c : classes) {
        if (c.isSubClassOf(OSecurityShared.RESTRICTED_CLASSNAME))
          throw new OSecurityException("Class " + c.getName()
              + " cannot be truncated because has record level security enabled (extends " + OSecurityShared.RESTRICTED_CLASSNAME
              + ")");
      }
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityException

    return RESULT.RECORD_NOT_CHANGED;
  }

  private RESULT encodePassword(final ODocument iDocument) {
    if (iDocument.field("name") == null)
      throw new OSecurityException("User name not found");

    final String password = (String) iDocument.field("password");

    if (password == null)
      throw new OSecurityException("User '" + iDocument.field("name") + "' has no password");

    if (!password.startsWith(OSecurityManager.ALGORITHM_PREFIX)) {
      iDocument.field("password", OUser.encryptPassword(password));
      return RESULT.RECORD_CHANGED;
    }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityException

  }

  @Override
  public RESULT onRecordBeforeUpdate(final ODocument iDocument) {
    if (!isAllowed(iDocument, OSecurityShared.ALLOW_UPDATE_FIELD, true))
      throw new OSecurityException("Cannot update record " + iDocument.getIdentity() + ": the resource has restricted access");
    return RESULT.RECORD_NOT_CHANGED;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityException

  }

  @Override
  public RESULT onRecordBeforeDelete(final ODocument iDocument) {
    if (!isAllowed(iDocument, OSecurityShared.ALLOW_DELETE_FIELD, true))
      throw new OSecurityException("Cannot delete record " + iDocument.getIdentity() + ": the resource has restricted access");
    return RESULT.RECORD_NOT_CHANGED;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.