forked from stetard/DNN.Repository
-
Notifications
You must be signed in to change notification settings - Fork 1
/
03.05.01.SqlDataProvider
151 lines (131 loc) · 3.67 KB
/
03.05.01.SqlDataProvider
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* =====================================================================*/
/***** Initialization Script 03.05.01 *****/
/* =====================================================================*/
/* =====================================================================*/
/* Add SecurityRoles column to RepositoryObjects table */
/* to allow the uploader to set a list of required roles in order to */
/* view or download the item */
/* =====================================================================*/
IF (SELECT COLUMNPROPERTY( OBJECT_ID('{databaseOwner}{objectQualifier}grmRepositoryObjects'),'SecurityRoles','AllowsNull')) IS NULL
ALTER TABLE {databaseOwner}{objectQualifier}grmRepositoryObjects ADD [SecurityRoles] [ntext] NULL
GO
/* =====================================================================*/
/* Drop Add and Update SProcs */
/* =====================================================================*/
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}grmAddRepositoryObject') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}{objectQualifier}grmAddRepositoryObject
GO
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}grmUpdateRepositoryObject') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}{objectQualifier}grmUpdateRepositoryObject
GO
/* =====================================================================*/
/* Create updated SProcs to support new SecurityRoles column */
/* =====================================================================*/
CREATE procedure {databaseOwner}{objectQualifier}grmAddRepositoryObject
@UserName nvarchar(150),
@ModuleID int,
@Name nvarchar(150),
@Description ntext,
@Author nvarchar(150),
@AuthorEMail nvarchar(150),
@FileSize nvarchar(12),
@PreviewImage nvarchar(150),
@Image nvarchar(150),
@FileName nvarchar(150),
@Approved int,
@ShowEMail int,
@Summary ntext,
@SecurityRoles ntext
as
insert into {databaseOwner}{objectQualifier}grmRepositoryObjects (
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate,
ModuleID,
[Name],
[Description],
Author,
AuthorEMail,
FileSize,
Downloads,
PreviewImage,
[Image],
[FileName],
Clicks,
RatingVotes,
RatingTotal,
RatingAverage,
Approved,
ShowEMail,
Summary,
SecurityRoles
)
values (
@UserName,
getdate(),
@UserName,
getdate(),
@ModuleID,
@Name,
@Description,
@Author,
@AuthorEMail,
@FileSize,
0,
@PreviewImage,
@Image,
@FileName,
0,
0,
0,
0,
@Approved,
@ShowEMail,
@Summary,
@SecurityRoles
)
select SCOPE_IDENTITY()
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE procedure {databaseOwner}{objectQualifier}grmUpdateRepositoryObject
@ItemID int,
@UserName nvarchar(150),
@Name nvarchar(150),
@Description ntext,
@Author nvarchar(150),
@AuthorEMail nvarchar(150),
@FileSize nvarchar(12),
@PreviewImage nvarchar(150),
@Image nvarchar(150),
@FileName nvarchar(150),
@Approved int,
@ShowEMail int,
@Summary ntext,
@SecurityRoles ntext
as
update {databaseOwner}{objectQualifier}grmRepositoryObjects
set
UpdatedByUser = @UserName,
UpdatedDate = getdate(),
[Name] = @Name,
[Description] = @Description,
Author = @Author,
AuthorEMail = @AuthorEMail,
FileSize = @FileSize,
PreviewImage = @PreviewImage,
[Image] = @Image,
[FileName] = @FileName,
Approved = @Approved,
ShowEMail = @ShowEMail,
Summary = @Summary,
SecurityRoles = @SecurityRoles
where ItemID = @ItemID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO