Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
db93bec3
Commit
db93bec3
authored
Oct 03, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group_access validation to ProjectGroupLink
parent
09b1f305
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
app/models/project_group_link.rb
app/models/project_group_link.rb
+3
-6
spec/models/project_group_link_spec.rb
spec/models/project_group_link_spec.rb
+1
-0
No files found.
app/models/project_group_link.rb
View file @
db93bec3
...
...
@@ -16,14 +16,11 @@ class ProjectGroupLink < ActiveRecord::Base
validates
:project_id
,
presence:
true
validates
:group_id
,
presence:
true
validates
:group_id
,
uniqueness:
{
scope:
[
:project_id
],
message:
"already shared with this group"
}
validates
:group_access
,
presence:
true
validates
:group_access
,
inclusion:
{
in:
Gitlab
::
Access
.
values
},
presence:
true
def
self
.
access_options
{
"Guest"
=>
GUEST
,
"Reporter"
=>
REPORTER
,
"Developer"
=>
DEVELOPER
,
"Master"
=>
MASTER
}
Gitlab
::
Access
.
options
end
def
self
.
default_access
...
...
spec/models/project_group_link_spec.rb
View file @
db93bec3
...
...
@@ -17,5 +17,6 @@ describe ProjectGroupLink do
it
{
should
validate_presence_of
(
:project_id
)
}
it
{
should
validate_uniqueness_of
(
:group_id
).
scoped_to
(
:project_id
).
with_message
(
/already shared/
)
}
it
{
should
validate_presence_of
(
:group_id
)
}
it
{
should
validate_presence_of
(
:group_access
)
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment