Merge "Add a 'security' flag to Teams"

This commit is contained in:
Zuul 2019-06-05 18:34:16 +00:00 committed by Gerrit Code Review
commit 4dcf96d324
3 changed files with 42 additions and 1 deletions

View File

@ -197,11 +197,15 @@ class Team(base.APIBase):
description = wtypes.text
"""Details about the team."""
security = bool
"""Whether or not the team is responsible for managing security issues."""
@classmethod
def sample(cls):
return cls(
name="StoryBoard-core",
description="Core reviewers of StoryBoard team.")
description="Core reviewers of StoryBoard team.",
security=False)
class Story(base.APIBase):

View File

@ -0,0 +1,36 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
"""Add a 'security' flag to Teams
Revision ID: 064
Revises: 063
Create Date: 2019-03-04 16:24:44.264120
"""
# revision identifiers, used by Alembic.
revision = '064'
down_revision = '063'
from alembic import op
import sqlalchemy as sa
def upgrade(active_plugins=None, options=None):
op.add_column('teams', sa.Column('security', sa.Boolean(), nullable=True))
def downgrade(active_plugins=None, options=None):
op.drop_column('teams', 'security')

View File

@ -211,6 +211,7 @@ class Team(ModelBuilder, Base):
schema.UniqueConstraint('name', name='uniq_team_name'),
)
name = Column(Unicode(CommonLength.top_middle_length))
security = Column(Boolean, default=False)
users = relationship("User", secondary="team_membership")
permissions = relationship("Permission", secondary="team_permissions",
backref="teams")