summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-django-global-permissions.spec286
-rw-r--r--sources1
3 files changed, 288 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..db2dde9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/django-global-permissions-0.2.6.tar.gz
diff --git a/python-django-global-permissions.spec b/python-django-global-permissions.spec
new file mode 100644
index 0000000..0cd0350
--- /dev/null
+++ b/python-django-global-permissions.spec
@@ -0,0 +1,286 @@
+%global _empty_manifest_terminate_build 0
+Name: python-django-global-permissions
+Version: 0.2.6
+Release: 1
+Summary: Implementation of permissions not related to models
+License: BSD
+URL: https://github.com/eduardo-matos/django-global-permissions
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/10/41/799967df3b02a6961f314ee8d31a9fb27f975f4bcbaad11b1ca489fab228/django-global-permissions-0.2.6.tar.gz
+BuildArch: noarch
+
+Requires: python3-django
+
+%description
+# Django Global Permissions
+
+[![Build Status](https://travis-ci.org/eduardo-matos/django-global-permissions.svg?branch=master)](https://travis-ci.org/eduardo-matos/django-global-permissions)
+
+Implementation of permissions not related to models
+
+# Quickstart
+
+Install django-global-permissions:
+
+```
+pip install django-global-permissions
+```
+
+Add to installed apps:
+
+```python
+INSTALLED_APPS += ('global_permissions',)
+```
+
+If you want to create a permission in the admin interface, then head to
+the Global Permissions section and click _add_. Pick a name (which should be
+human readable), a code name (which will be used throughout your apps), then save it.
+Open the user edit page and choose the permission you've just created.
+
+![](https://user-images.githubusercontent.com/483681/33212448-58a39f36-d10a-11e7-88c9-332df034188c.gif)
+
+Otherwise if you want to create a permission programmatically, just import the `GlobalPermission`
+model and create a new permission choosing a name and a codename.
+
+```python
+from global_permissions.models import GlobalPermission
+
+GlobalPermission.objects.create(name='My Perm', codename='my_perm')
+```
+
+## Putting into action!
+
+Lets say you want to verify if the logged in user can do something (based on a permission).
+In your view, you can do the following
+
+```python
+if user.has_perm('global_permissions.my_perm_codename'):
+ pass # do something intersting!
+else:
+ pass # ops, you're not allowed to do that. Sorry ¯\_(ツ)_/¯
+```
+
+If you want to check a permission in a template, you can do it like this:
+
+```htmldjango
+{% if perms.global_permissions.my_perm_codename %}
+ Yay!
+{% else %}
+ Not so lucky...
+{% endif %}
+```
+
+## Upgrade
+
+If you're upgrading from version 0.1.x to version 0.2.x, you have to manually update the old contentttype model attribute to the new one. The following script may do the trick:
+
+```python
+from django.contrib.contenttypes.models import ContentType
+
+ContentType.objects.filter(name='global_permission', app_label='global_permissions').update(model='globalpermission')
+```
+
+This change is required on django 1.7+ to avoid a prompt asking if you want to remove staled content types after running a migration.
+
+
+
+
+%package -n python3-django-global-permissions
+Summary: Implementation of permissions not related to models
+Provides: python-django-global-permissions
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-django-global-permissions
+# Django Global Permissions
+
+[![Build Status](https://travis-ci.org/eduardo-matos/django-global-permissions.svg?branch=master)](https://travis-ci.org/eduardo-matos/django-global-permissions)
+
+Implementation of permissions not related to models
+
+# Quickstart
+
+Install django-global-permissions:
+
+```
+pip install django-global-permissions
+```
+
+Add to installed apps:
+
+```python
+INSTALLED_APPS += ('global_permissions',)
+```
+
+If you want to create a permission in the admin interface, then head to
+the Global Permissions section and click _add_. Pick a name (which should be
+human readable), a code name (which will be used throughout your apps), then save it.
+Open the user edit page and choose the permission you've just created.
+
+![](https://user-images.githubusercontent.com/483681/33212448-58a39f36-d10a-11e7-88c9-332df034188c.gif)
+
+Otherwise if you want to create a permission programmatically, just import the `GlobalPermission`
+model and create a new permission choosing a name and a codename.
+
+```python
+from global_permissions.models import GlobalPermission
+
+GlobalPermission.objects.create(name='My Perm', codename='my_perm')
+```
+
+## Putting into action!
+
+Lets say you want to verify if the logged in user can do something (based on a permission).
+In your view, you can do the following
+
+```python
+if user.has_perm('global_permissions.my_perm_codename'):
+ pass # do something intersting!
+else:
+ pass # ops, you're not allowed to do that. Sorry ¯\_(ツ)_/¯
+```
+
+If you want to check a permission in a template, you can do it like this:
+
+```htmldjango
+{% if perms.global_permissions.my_perm_codename %}
+ Yay!
+{% else %}
+ Not so lucky...
+{% endif %}
+```
+
+## Upgrade
+
+If you're upgrading from version 0.1.x to version 0.2.x, you have to manually update the old contentttype model attribute to the new one. The following script may do the trick:
+
+```python
+from django.contrib.contenttypes.models import ContentType
+
+ContentType.objects.filter(name='global_permission', app_label='global_permissions').update(model='globalpermission')
+```
+
+This change is required on django 1.7+ to avoid a prompt asking if you want to remove staled content types after running a migration.
+
+
+
+
+%package help
+Summary: Development documents and examples for django-global-permissions
+Provides: python3-django-global-permissions-doc
+%description help
+# Django Global Permissions
+
+[![Build Status](https://travis-ci.org/eduardo-matos/django-global-permissions.svg?branch=master)](https://travis-ci.org/eduardo-matos/django-global-permissions)
+
+Implementation of permissions not related to models
+
+# Quickstart
+
+Install django-global-permissions:
+
+```
+pip install django-global-permissions
+```
+
+Add to installed apps:
+
+```python
+INSTALLED_APPS += ('global_permissions',)
+```
+
+If you want to create a permission in the admin interface, then head to
+the Global Permissions section and click _add_. Pick a name (which should be
+human readable), a code name (which will be used throughout your apps), then save it.
+Open the user edit page and choose the permission you've just created.
+
+![](https://user-images.githubusercontent.com/483681/33212448-58a39f36-d10a-11e7-88c9-332df034188c.gif)
+
+Otherwise if you want to create a permission programmatically, just import the `GlobalPermission`
+model and create a new permission choosing a name and a codename.
+
+```python
+from global_permissions.models import GlobalPermission
+
+GlobalPermission.objects.create(name='My Perm', codename='my_perm')
+```
+
+## Putting into action!
+
+Lets say you want to verify if the logged in user can do something (based on a permission).
+In your view, you can do the following
+
+```python
+if user.has_perm('global_permissions.my_perm_codename'):
+ pass # do something intersting!
+else:
+ pass # ops, you're not allowed to do that. Sorry ¯\_(ツ)_/¯
+```
+
+If you want to check a permission in a template, you can do it like this:
+
+```htmldjango
+{% if perms.global_permissions.my_perm_codename %}
+ Yay!
+{% else %}
+ Not so lucky...
+{% endif %}
+```
+
+## Upgrade
+
+If you're upgrading from version 0.1.x to version 0.2.x, you have to manually update the old contentttype model attribute to the new one. The following script may do the trick:
+
+```python
+from django.contrib.contenttypes.models import ContentType
+
+ContentType.objects.filter(name='global_permission', app_label='global_permissions').update(model='globalpermission')
+```
+
+This change is required on django 1.7+ to avoid a prompt asking if you want to remove staled content types after running a migration.
+
+
+
+
+%prep
+%autosetup -n django-global-permissions-0.2.6
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-django-global-permissions -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.6-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..36c9d08
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+1bc4a741759c88e50dc3243c5c221365 django-global-permissions-0.2.6.tar.gz