Skip to content

Instantly share code, notes, and snippets.

View Wrufesh's full-sized avatar
💭
On mission

Rupesh Singh Wrufesh

💭
On mission
  • IIASA
  • Austria
  • 09:11 (UTC -12:00)
  • X @wrufesh
View GitHub Profile
from irhrs.organization.api.v1.tests.factory import OrganizationFactory
from irhrs.users.api.v1.tests.factory import UserFactory
from irhrs.payroll.tests.utils import PackageUtil
organization = OrganizationFactory()
user = UserFactory(_organization=organization)
@Wrufesh
Wrufesh / model_permission_interface.py
Last active July 16, 2020 09:41
Generic permission interface which can be applied on any Object or objects for full access control.
class ModelPermissionInterface:
@classmethod
def is_superuser(cls, user, obj=None):
"""
Return True or False
If True user have all permission constants
"""
raise NotImplementedError('Not impemented yet')
@classmethod
ko.bindingHandlers.selectize = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
if (!allBindingsAccessor.has('optionsText'))
allBindingsAccessor = inject_binding(allBindingsAccessor, 'optionsText', 'name');
if (!allBindingsAccessor.has('optionsValue'))
allBindingsAccessor = inject_binding(allBindingsAccessor, 'optionsValue', 'id');
if (typeof allBindingsAccessor.get('optionsCaption') == 'undefined')
allBindingsAccessor = inject_binding(allBindingsAccessor, 'optionsCaption', 'Choose...');
@Wrufesh
Wrufesh / netscanner.py
Created December 23, 2014 17:30
NETSCANNER- Python script to know the computers connected to your network
import subprocess
import sys
class Netscan:
def parser(self,*cmd):
try:
self.output=subprocess.check_output(cmd)
except:
print("Check your command once again.")
print("The required program may not exist.")
print("Or you are not a superuser\nThis program needs root privilege.")