@@ -0,0 +1,930 @@
+# -*- coding: utf-8 -*-%0A#%0A# Copyright (c) 2015 Red Hat%0A# Licensed under The MIT License (MIT)%0A# http://opensource.org/licenses/MIT%0A#%0Aimport json%0A%0Afrom pdc_client.plugins import PDCClientPlugin%0A%0A%0Aclass PermissionPlugin(PDCClientPlugin):%0A    def register(self):%0A        subcmd = self.add_command('list-my-permissions', help='list my permissions')%0A        subcmd.set_defaults(func=self.permission_list)%0A%0A    def permission_list(self, args):%0A        permissions = self.__get_permissions(self.client.auth%5B'current-user'%5D)%0A        if args.json:%0A            print json.dumps(permissions)%0A            return%0A%0A        for permission in sorted(permissions):%0A            print permission%0A%0A    def __get_permissions(self, res, **kwargs):%0A        %22%22%22%0A        This call returns current login user's permissions.%0A        %22%22%22%0A        response = res(**kwargs)%0A        return response.get('permissions', None)%0A%0A%0APLUGIN_CLASSES = %5BPermissionPlugin%5D%0A

Add permission plugin to client