summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/permissions/ImagePerms.java
blob: 9633e13b720ab8db235ac6211f62b41dd6d510a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package org.openslx.dozmod.permissions;

import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
import org.openslx.dozmod.thrift.Session;

/**
 * Class for checking, whether user can edit given image
 */
public class ImagePerms {

	public static boolean canEdit(ImageDetailsRead image){
		if(image.getOwnerId().equals(Session.getUserId())) 
			return true;
		if(image.userPermissions !=null) {
			return image.userPermissions.edit;
		}
		return image.defaultPermissions.edit;
	}

}