Search in sources :

Example 26 with MangoPermission

use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by MangoAutomation.

the class EventInstanceDao method deletePostRelationalData.

@Override
public void deletePostRelationalData(EventInstanceVO vo) {
    MangoPermission readPermission = vo.getReadPermission();
    permissionService.deletePermissions(readPermission);
}
Also used : MangoPermission(com.infiniteautomation.mango.permission.MangoPermission)

Example 27 with MangoPermission

use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by MangoAutomation.

the class FileStoreDao method savePreRelationalData.

@Override
public void savePreRelationalData(FileStore existing, FileStore vo) {
    MangoPermission readPermission = permissionService.findOrCreate(vo.getReadPermission());
    vo.setReadPermission(readPermission);
    MangoPermission writePermission = permissionService.findOrCreate(vo.getWritePermission());
    vo.setWritePermission(writePermission);
}
Also used : MangoPermission(com.infiniteautomation.mango.permission.MangoPermission)

Example 28 with MangoPermission

use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by MangoAutomation.

the class FileStoreDao method mapRecord.

@Override
public FileStore mapRecord(Record record) {
    FileStore result = new FileStore();
    result.setId(record.get(table.id));
    result.setXid(record.get(table.xid));
    result.setName(record.get(table.name));
    result.setReadPermission(new MangoPermission(record.get(table.readPermissionId)));
    result.setWritePermission(new MangoPermission(record.get(table.writePermissionId)));
    return result;
}
Also used : FileStore(com.serotonin.m2m2.vo.FileStore) MangoPermission(com.infiniteautomation.mango.permission.MangoPermission)

Example 29 with MangoPermission

use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by MangoAutomation.

the class JsonDataDao method mapRecord.

@Override
public JsonDataVO mapRecord(Record record) {
    JsonDataVO vo = new JsonDataVO();
    vo.setId(record.get(table.id));
    vo.setXid(record.get(table.xid));
    vo.setName(record.get(table.name));
    vo.setJsonData(extractDataFromObject(record.get(table.data)));
    vo.setReadPermission(new MangoPermission(record.get(table.readPermissionId)));
    vo.setEditPermission(new MangoPermission(record.get(table.editPermissionId)));
    return vo;
}
Also used : JsonDataVO(com.serotonin.m2m2.vo.json.JsonDataVO) MangoPermission(com.infiniteautomation.mango.permission.MangoPermission)

Example 30 with MangoPermission

use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by MangoAutomation.

the class SystemPermissionDao method update.

/**
 * Update the permission
 */
public void update(String permissionTypeName, MangoPermission existing, MangoPermission permission) {
    if (!existing.equals(permission)) {
        permissionService.deletePermissions(existing);
    }
    MangoPermission toUpdate = permissionService.findOrCreate(permission);
    this.create.update(SYSTEM_PERMISSIONS).set(SYSTEM_PERMISSIONS.permissionId, toUpdate.getId()).where(SYSTEM_PERMISSIONS.permissionType.eq(permissionTypeName)).execute();
}
Also used : MangoPermission(com.infiniteautomation.mango.permission.MangoPermission)

Aggregations

MangoPermission (com.infiniteautomation.mango.permission.MangoPermission)163 Role (com.serotonin.m2m2.vo.role.Role)38 HashSet (java.util.HashSet)35 Set (java.util.Set)32 HashMap (java.util.HashMap)23 PermissionDefinition (com.serotonin.m2m2.module.PermissionDefinition)21 NotFoundException (com.infiniteautomation.mango.util.exception.NotFoundException)19 JsonException (com.serotonin.json.JsonException)18 ValidationException (com.infiniteautomation.mango.util.exception.ValidationException)15 JsonValue (com.serotonin.json.type.JsonValue)13 TranslatableJsonException (com.serotonin.m2m2.i18n.TranslatableJsonException)13 JsonArray (com.serotonin.json.type.JsonArray)11 IOException (java.io.IOException)10 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)10 User (com.serotonin.m2m2.vo.User)9 JsonObject (com.serotonin.json.type.JsonObject)8 DataSourceVO (com.serotonin.m2m2.vo.dataSource.DataSourceVO)7 ResultSet (java.sql.ResultSet)7 TranslatableMessage (com.serotonin.m2m2.i18n.TranslatableMessage)6