1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.DataAccess.ADOHelper;
|
---|
6 | using HeuristicLab.Security.Contracts.BusinessObjects;
|
---|
7 | using HeuristicLab.Security.DataAccess;
|
---|
8 | using HeuristicLab.Security.ADODataAccess.TableAdapterWrapper;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Security.ADODataAccess {
|
---|
11 | class PermissionAdapter: DataAdapterBase<
|
---|
12 | dsSecurityTableAdapters.PermissionTableAdapter,
|
---|
13 | Permission,
|
---|
14 | dsSecurity.PermissionRow>,
|
---|
15 | IPermissionAdapter {
|
---|
16 | public PermissionAdapter() :
|
---|
17 | base(new PermissionAdapterWrapper()) {
|
---|
18 | }
|
---|
19 |
|
---|
20 | protected override dsSecurity.PermissionRow ConvertObj(Permission perm,
|
---|
21 | dsSecurity.PermissionRow row) {
|
---|
22 | if (row != null && perm != null) {
|
---|
23 | row.PermissionId = perm.Id;
|
---|
24 | row.Name = perm.Name;
|
---|
25 | row.Description = perm.Description;
|
---|
26 | row.Plugin = perm.Plugin;
|
---|
27 |
|
---|
28 | return row;
|
---|
29 | } else {
|
---|
30 | return null;
|
---|
31 | }
|
---|
32 | }
|
---|
33 |
|
---|
34 | protected override Permission ConvertRow(dsSecurity.PermissionRow row,
|
---|
35 | Permission perm) {
|
---|
36 | if (row != null && perm != null) {
|
---|
37 | perm.Id = row.PermissionId;
|
---|
38 | if (!row.IsNameNull())
|
---|
39 | perm.Name = row.Name;
|
---|
40 | else
|
---|
41 | perm.Name = String.Empty;
|
---|
42 |
|
---|
43 | if (!row.IsDescriptionNull())
|
---|
44 | perm.Description = row.Description;
|
---|
45 | else
|
---|
46 | perm.Description = String.Empty;
|
---|
47 |
|
---|
48 | if (!row.IsPluginNull())
|
---|
49 | perm.Plugin = row.Plugin;
|
---|
50 | else
|
---|
51 | perm.Plugin = String.Empty;
|
---|
52 |
|
---|
53 | return perm;
|
---|
54 | } else {
|
---|
55 | return null;
|
---|
56 | }
|
---|
57 | }
|
---|
58 |
|
---|
59 | #region IPermissionAdapter Members
|
---|
60 |
|
---|
61 | public GrantedPermission getPermission(PermissionOwner permissionOwner,
|
---|
62 | Permission permission,
|
---|
63 | Guid entityId) {
|
---|
64 | throw new NotImplementedException();
|
---|
65 | }
|
---|
66 |
|
---|
67 | public bool grantPermission(Guid permissionOwnerId,
|
---|
68 | Guid permissionId,
|
---|
69 | Guid entityId) {
|
---|
70 | throw new NotImplementedException();
|
---|
71 | }
|
---|
72 |
|
---|
73 | public bool revokePermission(Guid permissionOwnerId,
|
---|
74 | Guid permissionId,
|
---|
75 | Guid entityId) {
|
---|
76 | throw new NotImplementedException();
|
---|
77 | }
|
---|
78 |
|
---|
79 | #endregion
|
---|
80 | }
|
---|
81 | }
|
---|