-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
services: added group resource service permission
- Loading branch information
Showing
3 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
ziggurat_foundations/models/services/group_resource_permission.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from __future__ import unicode_literals | ||
from ziggurat_foundations.models.services import BaseService | ||
from ziggurat_foundations.models.base import get_db_session | ||
|
||
__all__ = ['GroupResourcePermissionService'] | ||
|
||
|
||
class GroupResourcePermissionService(BaseService): | ||
@classmethod | ||
def get(cls, group_id, resource_id, perm_name, db_session=None): | ||
""" | ||
Fetch row using primary key - | ||
will use existing object in session if already present | ||
:param group_id: | ||
:param resource_id: | ||
:param perm_name: | ||
:param db_session: | ||
:return: | ||
""" | ||
db_session = get_db_session(db_session) | ||
return db_session.query(cls.model).get( | ||
[group_id, resource_id, perm_name]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters