app/soc/cache/rights.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Wed, 27 May 2009 03:31:58 +0200
changeset 2365 a66e1dd8ced7
parent 1307 091a21cf3627
permissions -rw-r--r--
Add pylint: disable-msg= where needed in Melange modules.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1033
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
1307
091a21cf3627 Update the copyright notice for 2009.
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1248
diff changeset
     3
# Copyright 2009 the Melange authors.
1033
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
"""Module contains rights memcache functions.
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
"""
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
    '"Sverre Rabbelier" <sverre@rabbelier.nl>',
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
  ]
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
from google.appengine.api import memcache
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
RIGHTS = [
1070
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    29
    'checkCanCreateFromRequest',
1163
d8c50be19232 Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1135
diff changeset
    30
    'checkCanEditTimeline',
1070
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    31
    'checkCanMakeRequestToGroup',
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    32
    'checkCanProcessRequest',
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    33
    'checkHasPickGetArgs',
1248
f318538394d9 Rename checkHasActiveRole to checkHasActiveRoleForScope
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1203
diff changeset
    34
    'checkHasActiveRoleForScope',
1070
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    35
    'checkHasUserEntity',
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    36
    'checkIsActive',
1163
d8c50be19232 Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1135
diff changeset
    37
    'checkIsAllowedToManageRole',
1070
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    38
    'checkIsApplicationAccepted',
1033
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
    'checkIsDeveloper',
1135
24d695060863 Hook up the ACL system for documents.
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1114
diff changeset
    40
    'checkIsDocumentReadable',
24d695060863 Hook up the ACL system for documents.
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1114
diff changeset
    41
    'checkIsDocumentWritable',
1163
d8c50be19232 Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1135
diff changeset
    42
    'checkIsHostForProgram',
1070
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    43
    'checkIsLoggedIn',
1163
d8c50be19232 Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1135
diff changeset
    44
    'checkIsMyEntity',
1070
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    45
    'checkIsMyGroupAcceptedRequest',
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    46
    'checkIsUnusedAccount',
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    47
    'checkIsUser',
1163
d8c50be19232 Cleaned up access.py
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1135
diff changeset
    48
    'checkIsUserSelf',
1070
1ff364d96b02 Fixed rights flushing
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1033
diff changeset
    49
    'checkNotLoggedIn',
1033
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
    ]
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
def flush(id):
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
  """Flushes all ACL's for the specified account.
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    55
  """
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    56
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    57
  key_prefix = '%s.' % id
2365
a66e1dd8ced7 Add pylint: disable-msg= where needed in Melange modules.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1307
diff changeset
    58
  # pylint: disable-msg=E1101
1033
71ff49dbb4b6 Also flush the user's ACL's when flushing the sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    59
  memcache.delete_multi(RIGHTS, key_prefix=key_prefix)