Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / FileProperties / Permission.cs @ aba9e6d9

History | View | Annotate | Download (1.3 kB)

1
using Caliburn.Micro;
2

    
3
namespace Pithos.Client.WPF
4
{
5
    public class Permission:PropertyChangedBase
6
    {
7
        private string _userName;
8
        public string UserName
9
        {
10
            get { return _userName; }
11
            set
12
            {
13
                _userName = value;
14
                NotifyOfPropertyChange(()=>UserName);
15
            }
16
        }
17

    
18
        private bool _read;
19
        public bool Read
20
        {
21
            get { return _read; }
22
            set
23
            {
24
                _read = value;
25
                if (_read)
26
                    Write = false;
27
                NotifyOfPropertyChange(()=>Read);
28
            }
29
        }
30

    
31
        private bool _write;
32

    
33
        public bool Write
34
        {
35
            get { return _write; }
36
            set
37
            {
38
                _write = value;
39
                if (_write)
40
                    Read = false;
41
                NotifyOfPropertyChange(()=>Write);
42
            }
43
        }
44

    
45
        public Permission(string userName, string permission)
46
        {
47
            UserName = userName;
48
            Read = (string.Compare(permission, "read", true) == 0);
49
            Write= (string.Compare(permission, "write", true) == 0);
50
            Value = permission;
51
        }
52

    
53
        public string Value { get; private set; }
54

    
55
        public Permission()
56
        {
57
            
58
        }
59

    
60
    }
61
}