source: trunk/grails-app/domain/nl/tno/metagenomics/auth/Auth.groovy @ 2

Last change on this file since 2 was 2, checked in by robert@…, 9 years ago

Initial import of basic functionality

File size: 631 bytes
Line 
1package nl.tno.metagenomics.auth
2
3import nl.tno.metagenomics.Study
4
5/**
6 * This class provides the kind of authorization a user has on a specific study
7 *
8 * @author robert
9 *
10 */
11class Auth {
12        boolean canRead
13        boolean canWrite
14        boolean isOwner
15       
16        static belongsTo = [ study: Study, user: User ]
17       
18    static constraints = {
19    }
20       
21        static Auth authorization( Study study, User user ) {
22                return Auth.findByStudyAndUser( study, user );
23        }
24       
25        static Auth createAuth( Study study, User user ) {
26                Auth a = new Auth( canRead: false, canWrite: false, isOwner: false );
27                study.addToAuth( a );
28                user.addToAuth( a );
29                a.save();
30        }
31}
Note: See TracBrowser for help on using the repository browser.